Set the specific user in the list collector in the catalog item.

Supriya KM
Tera Contributor

Hello Everyone,

I have a list collector field taking sys_user table. I have written a script include with the specific assignment group and all the members are getting populated in the form as expected. 
But now I have a requirement where I need one specific user from the assignment group in the list collector and that user needs approval.
Existing : Select multiple members in the list collector and approvals are being sent from the workflow.
Required: Now I need if "X" choice is selected in the another variable I need specific user to be populated in the list collector and to send for approval.
Please help me with this.
Code in the workflow (approval user):

answer = [];

var approvers = current.variables.list_collector_field_name.toString();

var list = approvers.split(',');

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

    answer.push(list[i]);

}



1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

If you want to do this in the approval script, at the end of this script you would add something like this to push this other user's sys_id to the list collector value and approval:

if (current.variables.variable_name == 'variable_value') {
    answer.push('sys_id of additional user'); //or get this from a system property
    current.variables.list_collector_field_name += ',' + 'sys_id of additional user');
}