- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 02:31 PM
Hello,
I trying to populate the fields below when a business app is selected. It is working but bringing back value instead of Display Value. AND I am trying to bring back user cost center and populate
Any assistance is appreciated.
Field: Data Classification<-Auto-populated by Business Application field (Data Classification')
Thanks,
Chad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 02:59 AM - edited 01-26-2025 03:00 AM
Hello @purdue
Here is the updated script include:
getdataclassfication: function() {
var result = {};
var appName2 = this.getParameter('sysparm_appName');
var grAppRole2 = new GlideRecord('cmdb_ci_business_app');
grAppRole2.addQuery('name', appName2);
grAppRole2.setLimit(1);
grAppRole2.query();
if (grAppRole2.next()) {
result.roleDetails = grAppRole2.getValue('data_classification');
}
return JSON.stringify(result);
},
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 04:29 PM - edited 01-23-2025 04:37 PM
You need to set the display value in the command:
You're only setting the field name and the value, not the display value
You could also go and directly get the display value and add it:
var MyDisplayValue = g_form.getDisplayValue('your_variable_name');
g_form.setValue('data_classification', MyDisplayValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 08:35 PM
you can use Auto populate Utah feature and no scripting required
Based on reference variable you can set the other varaible
Auto-populate a variable based on a reference type variable (Utah)
If it still doesn't work then you can use GlideAjax and bring the label of that choice field (data_classification)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2025 06:17 PM
Hello,
The Auto Populate is not working it is bringing back the label on the item which is correct however once submitted the value is stored not the label so I will need to use GlideAjax. Please provide example of pulling the value from Business_App.Data Classification and setting it in a reference field which points to sys_choice where the data classification values are held. Thanks a bunch. Chad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2025 06:21 PM
The reason why I need the reference to point the sys_choice is some bus apps do not have data classification set so the user will need to select it but if it is populated set it from bus app.
Thanks a bunch,
Chad