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.

Fulfillment workflow script to assign fulfillment group based on requester select application

bbf3562
Kilo Guru

I want to make a script in fulfillment workflow that will assign specific fulfillment group depend on which business application the requester input(reference field). I have business application table(u_business_applications) where it has fulfillment group field called u_fulfillment_group. Here is screenshot of workflow,

find_real_file.png

In "Set Assignment Group", is this the correct code to get fulfillment group value from business application table based on requester choose business application name in reference field(business_application) and then assign it?

find_real_file.png

1 ACCEPTED SOLUTION

If that's the scenario then use the below script directly in create task run script



var gr = new GlideRecord('u_business_application');
gr.addQuery('sys_id', current.variables.business_application);
gr.addQuery('enabled', true);
gr.query();


while(gr.next())
{


task_glide_record.assignment_group = gr.u_fulfillment_group;


}



you need to update "task_glide_record" in the above script


View solution in original post

12 REPLIES 12

If that's the scenario then use the below script directly in create task run script



var gr = new GlideRecord('u_business_application');
gr.addQuery('sys_id', current.variables.business_application);
gr.addQuery('enabled', true);
gr.query();


while(gr.next())
{


task_glide_record.assignment_group = gr.u_fulfillment_group;


}



you need to update "task_glide_record" in the above script


I tried that code and test it. The assignment group in Catalog Task is blank.


find_real_file.png


Can you post the script in Run script catalog task here?


find_real_file.png


As I said you don't need the set assignment group at all



you need use this code in other activity