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 populate the Assignment Group field on a record created by a Record Producer

Richard Castill
Tera Contributor

Hello,

 

How to populate the Assignment Group field on a record created by a Record Producer...

 

I am wanting the Assignment Group field to be populated based on the Case Type selected on the Record Producer.  Am I looking at a script include with a Glide AJAX call in a client script? A Onload BR? A script in the Record Producer? 

 

Any guidance is appreciated... 

1 ACCEPTED SOLUTION

SoniaShridhar13
Giga Guru

@Richard Castill  you can use record producer script example shared below. If you find my response helpful please Mark Helpful to close the thread.. 

If (producer.varibale == 'ab')

current.assignment_group= 'xyz';

else

current.assignment_group= 'bde';

View solution in original post

8 REPLIES 8

SoniaShridhar13
Giga Guru

@Richard Castill  you can use record producer script example shared below. If you find my response helpful please Mark Helpful to close the thread.. 

If (producer.varibale == 'ab')

current.assignment_group= 'xyz';

else

current.assignment_group= 'bde';

I see now that the very Record Producer says:

Configure a script to accomplish tasks such as:
  • Redirecting the user to another page after the record producer is submitted
  • Displaying an info message at the top of the page the user is redirected to after the record producer is submitted
  • Dynamically assigning values to specific fields on the generated record

Sagar Pagar
Tera Patron

Hi @Richard Castill,

 

You can use the record producer scripts to auto-populate the assignment group based on your conditions.

 

Here is sample script -

if(producer.case_type == "type1"){
producer.assignment_group = "group1_sys_id";
} else if(producer.case_type == "type2"){
producer.assignment_group = "group2_sys_id";
} else if(producer.case_type == "type2"){
producer.assignment_group = "group2_sys_id";
} else {
producer.assignment_group = "group3_sys_id"; // default group sys_id
}

 

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Thank you for your reply Sagar,

 

I tried :

producer.assignment_group = "group1_sys_id";

 The code did not set the Assignment Group field.  I changed "producer." to "current." and it set the Assignment Group field based on the Case Type field selection.

current.assignment_group = "group2_sys_id";