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

@Atchutaram 

did you add alert and see if it gave correct value and went inside the IF?

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

Chaitanya ILCR
Kilo Patron

Hi @Atchutaram ,

 

are all those fields available on the form?

if not configure form layout and add those fields to the form

 

 

You can use the UI policies too. Add the condition and in the value add the sysid of the group in the UI policy action

ChaitanyaILCR_0-1754499839855.png

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

AndersBGS
Tera Patron
Tera Patron

Hi @Atchutaram ,

 

Can you please share a snip of your full configuration? The script should work according to how you have stated it above. 

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/