- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2016 11:28 AM
Hi Team,
IN Knowledge Management, we have one List collector type field "" this field contains Malaysia, Japan, China etc..For example, if I'm selecting Malaysia, Japan, China countries, based on these countries we need to send approval request their respective managers.
For Malaysia the approval request mail will send to two persons (managers)
For China the approval request mail will send to one manager
For Japan the approval request mail will send to three managers.
Previously, "" is a drop-down field and it contains above country name. So, in workflow we simply using switch case, approval user and send approval request mail to respective managers.
But, here my query is how to get "" values in workflow and how to send individual approval request to respective mangers.
Please suggest a solution/helpful script/workflow, to how can i get Article for and how to send individual approval request to respective mangers.
Previous Workflow: Previously "Article for" is a drop down values. But now it is a list collector type.
1. Field
2. Previous Workflow
Please suggest how can I update this workflow with present situation.
Thanks & Regards,
Prasanna Kumar
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2016 11:46 AM
Hi Prasanna,
You can click on advanced checkbox on approval activity and then trigger it based on your logic.
Script :
var answer =[];
var arrayUtil = new ArrayUtil();
var list = current.list_collector.getDisplayValue().toSring();
var arrayList = list.split(",");
if (arrayUtil.contains(arrayList, "Malaysia")) { //for ex if it is Malaysia
answer.push('PASS SYS_ID OF THE APPROVAL USER');
}
You can adjust the above code as per your logic.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2016 11:46 AM
Hi Prasanna,
You can click on advanced checkbox on approval activity and then trigger it based on your logic.
Script :
var answer =[];
var arrayUtil = new ArrayUtil();
var list = current.list_collector.getDisplayValue().toSring();
var arrayList = list.split(",");
if (arrayUtil.contains(arrayList, "Malaysia")) { //for ex if it is Malaysia
answer.push('PASS SYS_ID OF THE APPROVAL USER');
}
You can adjust the above code as per your logic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2016 01:56 AM
Hi Pradeep,
It's working and thank you for your help.
Thanks & Regards,
Prasanna Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 01:49 AM
Hi Pradeep,
Instead of passing users, how to pass users from groups?
Malaysia - 1member,
China - 1 member
Philippine - 3 members
When I create a KB article, by selecting Malaysia and Philippine the only 2 approvers are displaying instead of 4 members.
For that I'm using the following script in workflow:
var answer =[];
var arrayUtil = new ArrayUtil();
var list = current.u_article_for;
//gs.log("@@@@test list: "+list);
var arrayList = list.split(",");
//Malaysia
if (arrayUtil.contains(arrayList, "36db41e56f4866008e2ea981be3ee425")) { //for ex if it is Malaysia
//Get Approvers under Group i.e. 8f8aadf96f00a6008e2ea981be3ee4f6 for Malaysia
pushMembers('8f8aadf96f00a6008e2ea981be3ee4f6');
}
//China
if (arrayUtil.contains(arrayList, "12eb89e56f4866008e2ea981be3ee4ae")) {
pushMembers('c35ae1f96f00a6008e2ea981be3ee480');
}
//Philippines
if (arrayUtil.contains(arrayList, "2a2c89e56f4866008e2ea981be3ee4b4")) {
pushMembers('c6f0997d6fcc66008e2ea981be3ee4e6');
}
function pushMembers(grpSysId){
//Need to look up the Group Members
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group',grpSysId);
gr.query();
while (gr.next()){
answer.push(gr.user);
}
}
Please provide the solution. Thank you for your great help in advance.
Thanks & Regards,
Prasanna Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 02:25 AM
In your pushMembers function, change
answer.push(gr.user);
to
answer.push(gr.getValue('user'));