Assignment rule depending on variable

Cristina Esteve
Tera Contributor

Hi guys!

 

I have created a variable inside a Catalog item that it's a reference type to the table service_offering. I have called it assignemnt_group. This variable is working fine.

Then I have created the Assignment rule that applies to this item, but the script is not working for me.

I have tried with several things, no good results. There is a way I can do this, but with the variable instead with an specific value?

 

current.assignment_group.setDisplayValue("name_of_assignment_group_2");

 

1 ACCEPTED SOLUTION

Hi Cristina,

if the assignment group is on service catalog form this works

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
 
    if (newValue == 'Other') {
        g_form.setValue('assignment_group', 'ffb84337db3d2410ca98166f299619c5');
    } else {
        g_form.setValue('assignment_group', '04c88337db3d2410ca98166f29961943');
    }
}

if you need you need Assignment group to be picked from catalog variable
you can proceed with Assignment Rule, Flow Designer or BR Approach with below script can be used in Assignment Rule and Before BR on insert

if (current.variables.assignment_group) {
current.assignment_group = current.variables.assignment_group.toString();
}
with Flow get the Catalog variable action and update the RITM record.

if the solution works kindly mark helpful

Regards
Sudhanva Chandra D
Certified ArchX || 8x ServiceNow CIS

View solution in original post

6 REPLIES 6

Cristina Esteve
Tera Contributor

Just for clarification because I didn't gave the complete picture.

 

assignment_group is a reference to the table sys_user_goup and is set with the script on change:

 

 

CristinaEsteve_1-1793185930706.png

 

From now, none solution is working 😞

 

Hi Cristina,

if the assignment group is on service catalog form this works

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
 
    if (newValue == 'Other') {
        g_form.setValue('assignment_group', 'ffb84337db3d2410ca98166f299619c5');
    } else {
        g_form.setValue('assignment_group', '04c88337db3d2410ca98166f29961943');
    }
}

if you need you need Assignment group to be picked from catalog variable
you can proceed with Assignment Rule, Flow Designer or BR Approach with below script can be used in Assignment Rule and Before BR on insert

if (current.variables.assignment_group) {
current.assignment_group = current.variables.assignment_group.toString();
}
with Flow get the Catalog variable action and update the RITM record.

if the solution works kindly mark helpful

Regards
Sudhanva Chandra D
Certified ArchX || 8x ServiceNow CIS