- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2021 10:50 AM
I have Functional area List field on form, FTM and DTS,ODG as values
if i select one value in Functional Area, approval should go for the related group.
for eg. If i select FTM, the approval should go to FTM Group approval only.
I have tried Switch but it is requesting approvals from all existed groups so now i am trying with IF Condition like as shown in the below image but it's not working. Please help me how to write the condition if in case need to write any script i have written below script its throwing error
answer = ifScript();
function ifScript() {
if (current.u_functional_area.indexOf('FTM')>-1) {
return 'yes';
}
return 'no';
}
Related Images:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:15 AM
Let's make double sure this array doesn't give trouble:
Use this(Added another toString() in the answer push):
var approvers = current.fieldName.toString();//Replace your field name
var answer = [];
if (approvers) {
var approversArr = approvers.split(',');
for (var i = 0; i < approversArr.length; i++) {
answer.push(approversArr[i].toString());
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 08:46 AM
Hi Suzy,
Correct me if I'm wrong... If your list field has one group selected, there should only be one approval triggered. If 2 then both approvals triggered, and so on?
Also, if 'n' number of approvals are triggered, system should wait for all of those approvals to be approved. If any one rejects, its an end for all?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:00 AM
Hi Anirudh,
Thanks a lot for your reply :):)
Yes exactly!! I have tried multiple ways, it did not work for me 😞
tried Switch - but stuck with the condition to give
tried If - like the above code, but its results NO, though i have selected correct group.
Please Please help me what to write in workflow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:06 AM
Have you already tried the below script(our old script only, but this has a twist):
Add this in the Approval Group activity script
var approvers = current.fieldName.toString();//Replace your field name
var answer = [];
if (approvers) {
var approversArr = approvers.split(',');
for (var i = 0; i < approversArr.length; i++) {
answer.push(approversArr[i]);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:07 AM
Oh I forgot something!
Should the approvals trigger one by one(If 2 or more groups selected) or should they all tigger at the same time?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:10 AM
We can trigger at a time Anirudh
and the above code...shall i keep in Approval group Activity where i have added all the groups