How to define dynamic approval creation using approval activity in workflow.
This content was last updated in 2023. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 04:53 AM - edited ‎06-22-2023 04:54 AM
Hi ,
I am facing issue to define dynamic approval in the approval activity. Please find the code.
workflow.scratchpad.approver is storing username and is defined in the runscript of the wf. If workflow.scratchpad.approver is a member of the below group, then it would go to 2 approvers. else the approval will go the variable as mentioned as primary owner.
For the below, the approval is getting skipped.
//--------------- For Item XXXXXXX ------------------
else if (item == "XXXXXXX") {
if(workflow.scratchpad.approver.isMemberOf('Group'))
{
answer = ['4f7a90c9dbb5a700ce59a155059619c6', '8df91445dbb5a700ce59a15505961922'];
}
else {
if (workflow.scratchpad.request_type == "create" || workflow.scratchpad.request_type == "delete") {
answer = [current.variables.primary_owner];
} else {
var answer = [];
answer.push(current.variables.primary_owner);
answer.push(current.variables.new_primary_owner);
}
}
}
Could you please help me with the above code so that the approval goes to the mentioned sysids else primary owner.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 08:15 AM
Hi @Ankur Bawiskar , How to mention two individual approvers so that if anyone of the approver approves, it proceeds the next step. Could you please confirm this ?
if(gs.getUser().getUserByID(workflow.scratchpad.approver).isMemberOf('Group'))
{
answer = ['4f7a90c9dbb5a700ce59a155059619c6', '8df91445dbb5a700ce59a15505961922'];
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 09:30 AM
that is defined in workflow activity
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 10:59 AM
Thank You for your help @Ankur Bawiskar . It is working now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 08:42 PM