> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: getLabel(key: string, options: GetLabelOptions) # Method package: wixCrmV2 # Method menu location: wixCrmV2 --> labels --> getLabel # Method Link: https://dev.wix.com/docs/velo/apis/wix-crm-v2/labels/get-label.md # Method Description: Retrieves a label by the specified label key. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get a specified label (dashboard page code) ```javascript import { labels } from 'wix-crm.v2'; /* Sample key value: 'custom.at-risk' */ export async function myGetLabelFunction(key) { try { const label = await labels.getLabel(key); console.log('successfully retrieved label:', label); return label; } catch (error) { console.log(error); // Handle the error } } /* Promise resolves to: * { * "namespace": "custom", * "namespaceDisplayName": "Labels", * "key": "custom.at-risk", * "displayName": "At Risk", * "labelType": "USER_DEFINED", * "legacyId": "65bd6a68-e10e-4831-8d92-c90e75be1570", * "_createdDate": "2023-12-25T08:38:36.000Z", * "_updatedDate": "2023-12-25T08:38:36.000Z" * } */ ``` ## Get a specified label (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { labels } from 'wix-crm.v2'; import { elevate } from 'wix-auth'; /* Sample key value: 'custom.at-risk' */ export const myGetLabelFunction = webMethod(Permissions.Anyone, async (key) => { try { const elevatedGetLabel = elevate(labels.getLabel); const label = await elevatedGetLabel(key); console.log('successfully retrieved label:', label); return label; } catch (error) { console.log(error); // Handle the error } }); /* Promise resolves to: * { * "namespace": "custom", * "namespaceDisplayName": "Labels", * "key": "custom.at-risk", * "displayName": "At Risk", * "labelType": "USER_DEFINED", * "legacyId": "65bd6a68-e10e-4831-8d92-c90e75be1570", * "_createdDate": "2023-12-25T08:38:36.000Z", * "_updatedDate": "2023-12-25T08:38:36.000Z" * } */ ``` ## Get the display name for a specified label ```javascript import { labels } from 'wix-crm.v2'; import { elevate } from 'wix-auth'; /* Sample key value: 'custom.at-risk' */ export async function myGetLabelFunction(key) { try { const elevatedGetLabel = elevate(labels.getLabel); const label = await elevatedGetLabel(key); const displayName = label.displayName; console.log('successfully retrieved the display name:', displayName); return displayName; } catch (error) { console.log(error); // Handle the error } } // Return value: "At Risk" ``` ## Get the display name for a specified label ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { labels } from 'wix-crm.v2'; import { elevate } from 'wix-auth'; /* Sample key value: 'custom.at-risk' */ export const myGetLabelFunction = webMethod(Permissions.Anyone, async (key) => { try { const elevatedGetLabel = elevate(labels.getLabel); const label = await elevatedGetLabel(key); const displayName = label.displayName; console.log('successfully retrieved the display name:', displayName); return displayName; } catch (error) { console.log(error); // Handle the error } }); // Return value: "At Risk" ``` ---