Assignment Rules

Jon23
Mega Sage

I would like to use an assignment rule to assign an incident to the correct service desk group based on the callers geo location contained in the users record.

Any help on how to script this would be greatly appreciated - all my attempts have failed.

1 ACCEPTED SOLUTION

Jon23
Mega Sage

I have successfully used the following script to assign the group based on the users location.

var gr = new GlideRecord('sys_user');

if (gr.get(current.caller_id)){
var sd = gr.u_service_desk_geo;
current.assignment_group = sd;
}

However I am still having trouble setting the cmdb_ci value with the assignment rule script;

current.cmdb_ci = 'GSA';


View solution in original post

9 REPLIES 9

Jon23
Mega Sage

I have successfully used the following script to assign the group based on the users location.

var gr = new GlideRecord('sys_user');

if (gr.get(current.caller_id)){
var sd = gr.u_service_desk_geo;
current.assignment_group = sd;
}

However I am still having trouble setting the cmdb_ci value with the assignment rule script;

current.cmdb_ci = 'GSA';


The cmdb_ci is a refernce to the CMDB table. It is looking for the sys_id in your current assignment OR you can try using current.cmdb_ci.setDisplayValue('GSA');


Thanks Terri and Shabab,

Using the sys_id of the ci successfully set the cmdb_ci value.

One thing that was not obvious to me (and making me believe my scripts were incorrect), if the assignment rule has the 'Assignment group' and/or 'Assigned to' then the script does not get invoked.


shabaab_mazhar
Mega Expert

current.cmdb_ci = 'GSA';

should be either be replaced with

current.cmdb_ci.setDisplayValue('GSA');

or

current.cmdb_ci = '000000';// sys_id of the GSA record


jmrece
Kilo Contributor

hi,


We can go to "Data lookup definitions" and create new data lookup by selecting source and matcher table. After save select matcher field and setter field definitions. Matcher field definitions are for matching values and setter fields are for to which field we have to set value.



Upload data in assignment rules table and check in u r incident form.



Refer wiki for how to create data lookup and assignment rules for better idea. If any queries feel free to send amil. So that i can help on the same.



I tried recently to auto populate one field based on few fields and it's working perfect.