change of assignment group when conditions are met in incident.

Atchutaram
Tera Contributor

Hi Everyone,

 

When business service is cisco and channel is alert and alert severity is major, assignment group should be changed from servicedesk to netwrok team. So i have written a on change change of business service field client script. 

function onChange(control, oldValue, newValue, isLoading) {
    // Exit early if the form is loading or the new value is empty
    if (isLoading || newValue == '') {
        return;
    }

    // Get values from relevant fields
    var service = g_form.getValue('business_service');
    var channel = g_form.getValue('contact_type');
    var alertsev = g_form.getValue('u_alert_severity');

    // Check all conditions
    if (
        service == 'c6c44a961bd88d90e6966534b24bcb91' &&
        channel == 'alert' &&
        alertsev == 'major'
    ) {
        // Set assignment group if all conditions are met
        g_form.setValue('assignment_group', '850ae8e9db096b80dd1662eb0b961945');
}
}
This is not working and group is not changing, can you let me know how can i correct this?
 
 
 
7 REPLIES 7

Nikhil Bajaj9
Giga Sage

Hi @Atchutaram ,

 

Just a suggestion- why don't you use - Assignment rule rather than client script. Where configuration is avaialble, we should not write code.

 

Regards,

Nikhil Bajaj

Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj

Hi @Nikhil Bajaj9 , I have tried that, i can use assignment rules for category and sub category.

 

Best Regards,

Ram.

Ankur Bawiskar
Tera Patron
Tera Patron

@Atchutaram 

is it going inside that IF statement?

are you using correct values to compare for channel and alert severity?

are you using correct group sysId?

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

Hi @Ankur Bawiskar , yes i am using correct values.