- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 12:45 PM
Hi,
Is there any way to get field/column label on client side script ?
I tried following 2 ways but no luck.
1. var a = g_form.getLabel('business_group');
2. var a = g_form.getLabel('cmdb_ci_business_app.business_group'); //table.backend_name
Can we achieve this ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 06:23 PM
@SNDEV27 The correct method to extract the label is getLabelOf. Here is an example.
if (g_user.hasRole('itil')) {
var oldLabel = g_form.getLabelOf('comments');
g_form.setLabelOf('comments', oldLabel + ' (Customer visible)');
}
Please refer to this URL https://developer.servicenow.com/dev.do#!/reference/api/xanadu/client/c_GlideFormAPI#r_GlideFormGetL... for more information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 04:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 06:23 PM
@SNDEV27 The correct method to extract the label is getLabelOf. Here is an example.
if (g_user.hasRole('itil')) {
var oldLabel = g_form.getLabelOf('comments');
g_form.setLabelOf('comments', oldLabel + ' (Customer visible)');
}
Please refer to this URL https://developer.servicenow.com/dev.do#!/reference/api/xanadu/client/c_GlideFormAPI#r_GlideFormGetL... for more information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 06:26 PM
Hello @SNDEV27
For field label in client script you can refer this thread get Element of label from form in Client script
For column label in script include you can refer this get column labels of fields in a table
If this helped please hit like and mark it as an accepted solution.
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 07:10 PM
the correct method is below, what's your business requirement
g_form.getLabelOf('fieldName')
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader