Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 05:12 AM
Hi all,
I need to Auto-populate Short Description with Category- Subcategory on form load for incident. I have implemented the below code
function onLoad() {
var category = g_form.getDisplayValue('category');
var subcategory = g_form.getDisplayValue('subcategory');
var message = category + '- ' + subcategory;
g_form.setValue('short_description', message);
}
If we use .getDisplayValue the value setting as Incident Number both Category and subcategory.
if we use getValue its setting choice value not label.
please suggest.
please suggest.
Thanks all
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 05:17 AM
so you want choice label so use this
function onLoad() {
var category = g_form.getOption('category', g_form.getValue('category')).text;
var subcategory = g_form.getOption('category', g_form.getValue('subcategory')).text;
var message = category + '- ' + subcategory;
g_form.setValue('short_description', message);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 05:17 AM
so you want choice label so use this
function onLoad() {
var category = g_form.getOption('category', g_form.getValue('category')).text;
var subcategory = g_form.getOption('category', g_form.getValue('subcategory')).text;
var message = category + '- ' + subcategory;
g_form.setValue('short_description', message);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader