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 Can you please share the code logic inside the record producer?

@Community Alums 

Community Alums
Not applicable

Hi @Alon Grod ,

 Well to understand this requirement , you can learn from this doc : Populate record producer data and redirect users 

What i understood is that you want to map Route To variable to Assignment group field on the target table. If yes then there are two options.

Option 1: Make sure your variable name in Record producer is equal to column name of assignment group of the target table.

Or

Option 2: Use the map to a field in the Record producer variable.

SandeepDutta_0-1675687801301.png

 

 

For ex: Create a variable on the record producer with the same name as the field in the target record. For example, a variable named caller_id on a Create a New Incident record producer populates the caller_id field on the new incident record.

 

@Community Alums I dont have the variables assignment group and assigned to on the record producer, i only have them on the backend. The goal is to populate this two fields automatically based on the caller id after submitting the create incident record producer.