We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Issue with client Script

pravallikag6589
Tera Contributor

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?

 

pravallikag6589_0-1735014953309.png

 

pravallikag6589_1-1735014986925.png

 

8 REPLIES 8

Harish Bainsla
Kilo Patron

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

Ashish Parab
Mega Sage

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

Omkar Mone
Mega Sage

Hey,

 

I think you are not putting the backend names to check the values, please see below example from my PDI

 

OmkarMone_0-1735015984665.png

 

you need to use the backend names i.e. hardware, network etc.

Ankur Bawiskar
Tera Patron

@pravallikag6589 

what debugging have you done so far?

 

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader