The CreatorCon Call for Content is officially open! Get started here.

Adding approvers from a variable form field - skipping approval item

tcorniels
Tera Contributor

I have a Lookup Select Box on a catalog form (variable name TS_mgr).  I have a reference qualifier on the variable to pull the names out of a assignment group call TS Managers and that is working:

javascript:var gr = new GlideRecord('sys_user_grmember');gr.addQuery('group',"2fa4a9320fb2c200a91a244be1050e06");gr.query();var users='';while(gr.next()){users+=gr.user.sys_id + ",";}"sys_idIN" + users;

find_real_file.png

 

In the workflow I have a Approval - User item scripted a such:

answer = [];
answer.push(current.variables.TS_mgr);

 

The form works correctly in that it pulls the names of the user in the group.  When the workflow calls the Approval - User item it skips it and I'm not sure why.  I'm thinking it may be getting a null value so it thinks there is no approver?  Do I need to convert the variable to a string first (wouldn't think so)?

find_real_file.png

 

1 ACCEPTED SOLUTION

ccajohnson
Kilo Sage

That is what I expected. The answer array of an approval expects an array of sys_id values. See if you can change the Lookup value field to be SysID. You may also have to change the Lookup label(s) to be name so that the users will show up correctly.

Typically I use a reference field to pick the user, but since you have a lookup select box this makes the results a bit different.

View solution in original post

16 REPLIES 16

Mike Patel
Tera Sage

try answer = [];
answer.push(current.variables.TS_mgr.toString());

tcorniels
Tera Contributor

Nope.  Getting the same thing.  Is still skipping the Approval task.  I guess why else would it be skipping the approval task?

 

try 

answer = current.variables.TS_mgr;

also try

try answer = [];
answer.push(current.variables.TS_mgr.sys_id);