Issue with client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 08:37 PM
How can we configure a client script to automatically populate the Impact and Urgency fields as '3 - Low' when the category is set to 'HRMS' and a related sub-category is selected in an incident?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 08:46 PM
Hi @pravallikag6589 use onchange of category because category and sub category is dependent field and put condition like var cat = g_form.getValue('category');
then use if condition like if(cat==HRMS)
if my answer helps mark helpful and accept solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 08:52 PM
Hello @pravallikag6589 ,
You can try below onChange Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var category = g_form.getValue('category');
var subcategory = g_form.getValue('subcategory');
// Check if the Category is HRMS and a Subcategory is selected
if (category == 'HRMS' && subcategory) {
g_form.setValue('impact', '3');
g_form.setValue('urgency', '3');
}
}
Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.
Thanks and Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 08:53 PM
Hey,
I think you are not putting the backend names to check the values, please see below example from my PDI
you need to use the backend names i.e. hardware, network etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 09:13 PM
what debugging have you done so far?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
