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.

Populate previous assignment group on incident form

Ankita Gupte
Kilo Sage

Hi Experts,

I have created a field on incident form “Previous assignment group” which captures the value of previous assignment group. I have written below business rule to populate it but it’s working only if the variable field type is string.

 

current.u_previous_assignment_group = previous.assignment_group.getDisplayValue();

 

We want to use this field for report so that user can fetch it dynamically but it does not work if we keep the field type as reference.

 

Please help.

 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Ankita Gupte Please update your script as follows.

 

current.u_previous_assignment_group = previous.assignment_group+'';

//u_previous_assignment_group should be a reference field referring to sys_user_group.

Hope this helps.

View solution in original post

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@Ankita Gupte Please update your script as follows.

 

current.u_previous_assignment_group = previous.assignment_group+'';

//u_previous_assignment_group should be a reference field referring to sys_user_group.

Hope this helps.

Hi Sandeep, Hope you are doing well!

I have modified the script as below since I want to get only the first assignment group i.e. the assignment group used while creating the incident.

 

(function executeRule(current, previous /*null when async*/) {
if (current.u_previous_assignment_group == "") {
current.u_previous_assignment_group = previous.assignment_group+'';
}
})(current, previous);
 
But this is populating only when the first assignment group is empty due to my condition of checking if the field is empty.
 
How can I populate this field with the first assignment group on incident record.
Kindly advice.

Ankita Gupte
Kilo Sage

Thank you Sandeep. It working fine 😊

Ankita Gupte
Kilo Sage

Hi Sandeep, Hope you are doing well!

I have modified the script as below since I want to get only the first assignment group i.e. the assignment group used while creating the incident.

 

(function executeRule(current, previous /*null when async*/) {
if (current.u_previous_assignment_group == "") {
current.u_previous_assignment_group = previous.assignment_group+'';
}
})(current, previous);
 
But this is populating only when the first assignment group is empty due to my condition of checking if the field is empty.
 
How can I populate this field with the first assignment group on incident record.
Kindly advice.