- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 02:41 AM
As you have good number of choices to deal with with, it is suggested to go with "list collector WITH reference as table"(the table that holds those 50 values).
Thanks,
Saikiran Guduri (NOW)
Associate Certificate Engineer | ServiceNow Store Apps
(Please mark the answer as correct answer/helpful/accept the solution if it helps)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 02:47 AM
Yes, list collector. But, how do we get the values that user selected on the list collector and then map it to the table that we have containing the list of Approvers? Is this possible through scripting? Once we know who the required approvers are, the workflow should generate Approval requests for each selected value in the list collector.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 02:51 AM
Hi karrie,
From your requirement, the best thing for multiple selection is to use List collector,
To get the selected values of list collector use current.variable_pool.VARIABLE_NAME.getDisplayValue();
and try to write script as follows for approvals in approval activity.
answer =[];
var model = current.variable_pool.model.getDisplayValue();
var get_model = model.split(',');
for(i=0; i<get_model.length; i++){
if(get_model[i].trim()=='ABC' || get_model[i].trim()=='XYZ' ) {
answer.push('user1');
answer.push('user2');
continue;
}
if(get_model[i].trim()=='PQR'){
answer.push('user3');
continue;
}
Thanks,
Tripti S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 04:40 AM
Hi Tripti,
Thanks for your response.
Based on the sample script you sent, does that mean I should hard-code the values and approvers in the script in order to generate the approval requests?
Regards,
Karrie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 10:33 PM
Yea karrie,
If you are able to add dynamic values of users you can add,
By using glideRecord fetch the users and add users to array using answer.push();
Here is sample code:
var answer = [];
var member = new GlideRecord('Table NAme');
member.addQuery('u_user.name',"ABC");// add your code here as required
member.query();
while (member.next()) {
answer.push(member.getValue('u_user'));
Thanks,
Tripti S.