Array help-I need to take an array, compare against reference table, to create Approvals

Shane J
Tera Guru

I have an intake form with a List Collector variable (Variable: list_role) on it which references a table (Table: u_role).

I have another table (Table: u_approvers1) that has a reference to the same table.

Within this item's workflow, I need to be able to take the values from list_role, compare them against the tables in the u_approvers1 Table, and create Approval records for each.

 

What's the best way to attack this?  I have the start of what i think is needed to pull list_role apart but after that I'm not sure what to do with it.

 

*****

var list = current.variables.list_role.toString();

var array = list.split(",");

for (var i=0; i < array.length; i++) {


var rec = new GlideRecord('u_approvers1');

What do I do here?

}

1 ACCEPTED SOLUTION

I understand that, but if you're using a Group Approval activity, that requires the returned array contain group ids. Because you're using user ids, I think you want to use a User Approval activity instead of a Group Approval activity.

See: Group Approval and User Approval

Group Approval says

find_real_file.png

User Approval says

find_real_file.png

So, if you're using sys_ids that are sys_user records, you want to use a User Approval activity.

View solution in original post

7 REPLIES 7

approval.u_approver is a Reference to the User table.  I've checked the gs.log and it is spitting out sys_id that match correctly to the User table.

I understand that, but if you're using a Group Approval activity, that requires the returned array contain group ids. Because you're using user ids, I think you want to use a User Approval activity instead of a Group Approval activity.

See: Group Approval and User Approval

Group Approval says

find_real_file.png

User Approval says

find_real_file.png

So, if you're using sys_ids that are sys_user records, you want to use a User Approval activity.

Thanks Matthew, that was the issue.  Script works fine when it's in the right kind of Activity.  😉