Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to auto populate Assignment group and assigned to

Alon Grod
Tera Expert

Hi,

 

I have the record producer 'Create Incident' which create a record in incident table. On the incident table i have the fields assignment group and assigned to. How can I auto populate these fields using the record producer based on caller_id value from the record producer?

1 ACCEPTED SOLUTION

BharathChintala
Mega Sage

@Alon Grod you can write something like this in Record producer script

BharathChintala_0-1675691674881.png

 

var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", caller);
gr.query();
if (gr.next()) {
    if (gr.location == 'india') { // here you can check anything from user record and based on that you can set Assignment group and to.
        current.assignment_group = gs.getProperty('property name'); // declare a properrty of group sysid and call property here
        current.assigned_to = gs.getProperty('property name'); // declare a properrty of user sysid and call property here
    } else if (gr.location == 'usa') {
        current.assignment_group = gs.getProperty('property name'); // difine different property for other group related to USA
        current.assigned_to = gs.getProperty('property name'); // declare a different properrty of user sysid and call property here
    }
}
 
or else
go to assignment rules
BharathChintala_1-1675691745986.png

Define like this in conditions

BharathChintala_2-1675692133061.pngBharathChintala_3-1675692149547.png

 

In action give group name.

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

View solution in original post

10 REPLIES 10

Sai Kumar B
Mega Sage

@Alon Grod 

You can make use of the Record producer script

OR

You can also use OOB Assignment rules

 

@Sai Kumar B  can you please be more specific

Hi Alon,

 

Could you please help with more details? Like how you are populating Assignee and Assignment group based on caller variable/question from Record producer? what's the logic behind this?

 

@Alon Grod 

You can write code logic in the Record producer script to populate the Assignment group/Assigned to on basis of caller_id

OR

You can use the "Assignment rules" that are available in OOB.  You can go to the sysrule_assignment table and check existing rules on the Incident table and You can refer to them and create a new rule as per your requirement to populate the Assignment group/Assigned To on the incident record.