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

Sagar Pagar
Tera Patron

Hi @Bird1,

I would suggest to add assignment rule conditions on target table instead of record producer variables.

 

Sample scripts -

var entity = current.field_name;

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

 

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Hi Sagar,

 

The variable doesn't map to the field of 'sn_sm_legal_request' table. I tried with below script before but it doesn't work.

 

var entity = current.variables.align_entity_of_chop_applicant;

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

 

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Please write the below script in the script part of the record producer:-

 

Saurav11_0-1667272186382.png

 

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

 

Please mark my answer as correct based on Impact.

I tried with this script but not work.

 

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