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.

Setting Approval group based on field value's approval group

Steve7
Mega Contributor

Hi,

Currently I'm making a service request where I am making an approval - group activity (in the workflow) and trying to use a form field value's assignment group.

I've been attempting the following script to no success. Please see below:

var answer = [];

answer.push(current.variables.ci_name.assignment_group);

Note: ci_name is the form field value name (and pulling its value from the cmdb_ci table), and the assignment_group value is the field name on a Configuration Item form.

 

Any help is appreciated. Thank you

1 ACCEPTED SOLUTION

Steve7
Mega Contributor

Upon review of another team member's perspective, the coding I had opened the thread for is working now as expected. 

 

Honestly I'm not 100% sure why the correct code was failing. I appreciate the alternatives listed. Those should be used if needed.

 

Thank you all,

View solution in original post

9 REPLIES 9

sachin_namjoshi
Kilo Patron
Kilo Patron

Please use below code

 

var answer = [];

answer.push(current.ci_name.assignment_group);

 

Regards,

sachin

May need to do:

var answer = [];

answer.push(current.ci_name.assignment_group.toString());

Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi there,

 

I assessed my log to find certain errors. I should reference the field change_control or "Approval group" (the dictionary label).

However I keep finding this error "Cannot read property "change_control" from undefined" despite the ci record having an Approval Group.

Any thoughts on where else this maybe

You need to refer your CI column name.

What's change_control field? Is it reference field for cmdb_ci table?

 

Regards,

Sachin