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 auto populate assignment group on change task as same as change request ??

Siddhesh Gawade
Mega Sage
Mega Sage

I have requirment  to  auto populate assignment group on change task as same as change request. 

 

(function executeRule(current, previous /*null when async*/ ) {

 

var changetask = new GlideRecord('change_task');

changetask.assignment_group = current.assignment_group;

 

})(current, previous);

 

but this is not workling please help.

 

regards,

Siddhesh.

1 ACCEPTED SOLUTION

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello Siddhesh,

 

Solutions :-->

1) Create a dictionary override for the assignment group field on change task table and use the following script in the default value column

javascript:parent.assignment_group;

 

2)Code Snippet

task.assignment_group = current.assignment_group;

 

Regards,

Vaishnavi

 

View solution in original post

5 REPLIES 5

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello Siddhesh,

 

Solutions :-->

1) Create a dictionary override for the assignment group field on change task table and use the following script in the default value column

javascript:parent.assignment_group;

 

2)Code Snippet

task.assignment_group = current.assignment_group;

 

Regards,

Vaishnavi

 

You're 1st solution doesnt work

Gabor10
Mega Guru

Hello There!

Your current code only contains an empty GlideRecord object. You should use the addQuery()/addEncodedQuery() and query() methods to fetch the Change, only then you can properly reference it.

 

In your case however, you should be able to use dot-walking to achieve the same. Your BR should be a "Before" BR from the looks of it

 

current.assignment_group = parent.assignment_group;

ishwar09
Tera Contributor

Hi Siddhesh,

 

Go to Workflow : Change Request - Normal change tasks (and Checkout) > Create Task node > Under Advanced Script section add the following code : task.assignment_group = current.assignment_group;

 

If solved, Please mark the suggestion as helpful.

Thanks