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.

Assignment Rule script based on variables of record producer

Bird1
Mega Sage

Hello,

 

I need help. I am trying to write an assignment rule script based on variables of record producer undre table (sn_sm_legal_request).

 

I tried with below script but failed (nothing happen). Can anyone advise?

 

var entity = producer.variables.align_entity_of_chop_applicant.

if (entity == 'abc')
current.assignment_group.setDisplayValue("Commercial Legal");

11 REPLIES 11

I tried with this script but doesn't work.

 

var entity = producer.align_entity_of_chop_applicant;
if (entity == 'abc')
{
current.assignment_group.setDisplayValue("Commercial Legal");
}

Can you once check what value is coming in entity. use the below code below:-

 

var entity = producer.align_entity_of_chop_applicant;

gs.log('entity'+entity);
if (entity == 'abc')
{
current.assignment_group='sysidofthecommerciallegalgroup';
}

 

Please mark my answer as correct based on Impact.

Finally I found the root cause, the script is working fine since I first shared actually. 

 

The problem is the record producer's sys_id. Suppose that I copied it from another record producer, so that caused of unable to trigger the assignment rule because the applied to condition, I point to that one.

 

Bird1_0-1667286108909.png

 

I see so now you are going with the assignment group rule itself or you are setting it from record producer

Yes, finally I moved to record producer.

 

Thank you very much.