Workflow generating duplicate approver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 05:31 AM
Noticed:
Need to correct the duplicate approval that occurs when the
User Information - Approver: User Information is the same as the Module
"Who is your approver?"
Any ideas on the script to query so that whenever the user that is selected here:
Will not generate another approver when the name matches here:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 05:55 AM
Their might a workflow in the backend, can you share your workflow logic, so that I can help you out.
Because approvals have been sent via workflow.
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 06:10 AM
Workflow:
the IF statement has the following currently:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 07:57 AM - edited 04-13-2023 08:11 AM
Could you please tell me which activity is responsible for user information approval and which activity is responsible for Who is the approver? Because I am unable to determine the correct path OR let me suggest you something just add it accordingly, what ever the ---> goes towards the second approval please add a if activity before that:
You need to check whether
if(current.variables.userInfoApproval != current.variables.Who_IS_THE_Approver ){
answer = "yes";
}else
answer = "No";
It will go to that direction only when both are not similar, I hope this helps!
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 08:04 AM
So couple things both around scratch pad variables
- Store appover ids in an array after each approval and prevent it before the next by using an if
- At the start of the workflow you create a script activity
- The script will create an empty array assigned to a scratchpad variable that will be used later to keep track of every user who has approved .
- After the first approval ( and each other one ) you can have a script activity that will push the previous approver into the scratchpad array.
- Then before each approval or just the one your worried about a dupe you can have an if right before the approval
- inside the if you would check to see if the next approvers id is in the scratchpad array.
- if indexOf(current.variables.ApprovalField) ==-1 then continue to the approval if not then skip that one.
- At the start of the workflow you create a script activity
- Option two is store all approver ids in a scratchpad array and iterate through them and create approvals. Before adding each one to the array make sure they are not already there.
- Script at start of the workflow
- Create scratchpad approval array
- Create scratchpad approval index counter variable ( to know where we are at in the array )
- Add each approver in order to the array from your variables
- If statement to check if our index counter is at the length of the approver array
- if not then we get the approver at that index and create an approval
- then script to increment the index
- then go back to the if statement to see if we have another approver
- Else if the index is at max we know we made through each approver we needed and good to go
- if not then we get the approver at that index and create an approval
- Script at start of the workflow