- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2025 09:58 PM
Hi,
I have this use case where need to set, some fields once the caller is set to Abel Tuter, I used a CS onChange, I could say it is working but subcategory shows for les than a second then goes back to -none-
I used the following script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 04:52 PM
thank you for all your help, it was an issue with a capital letter on the category value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2025 10:02 PM
that's because subcategory is dependent on category
I hope you are setting the correct subcategory for the category you are setting via script.
give some timeout like 2-3 seconds and then set subcategory
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
02-12-2025 10:07 PM
something like this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == '62826bf03710200044e0bfc8bcbe5df1') { // Sys ID = Abel Tuter
g_form.setValue('category', 'end_user_devices'); // Set Category
g_form.setValue('short_description', 'This is the end user device'); // Short Description
g_form.setValue('impact', '2'); // Impact = Medium
g_form.setValue('urgency', '3'); // Urgency = Low
g_form.setValue('service_offering', 'fae7e9e7c3635210075edf3d050131a5'); // Set SO = Azure AD Auth
g_form.setValue('cmdb_ci', '780b8ce8735423002728660c4cf6a7e7'); // Set CI = *MACBOOK-AIR-13
setTimeout(function() {
g_form.setValue('subcategory', 'Keyboard'); // Set Subcategory
}, 3000);
}
}
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
02-19-2025 08:59 PM
Thank you for marking my response as helpful.
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
02-12-2025 10:18 PM
Hi @tom the,
Subcategories are dependent on categories so please verify whether you are providing the exact subcategory respect to category. Simply open the form and select category and check which values are appearing in subcategory then you can select only those subcategory.
Please accept my resolution if it works for you and thumps up.
Thanks
Jitendra