- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2024 04:41 AM - edited 11-09-2024 04:46 AM
Hello developers,
i am facing a issue with group approvals where multiple groups are available for approval and if i reject anyone . In sysapproval_group table its approval state is updated to rejected . Next if i approve any other group the rejected approval group is also updating to approved instead of being rejected.
In attached ss the first group approval is rejected and after approving the next group the first group also got updated to approved. Let me know if there is any oob solution for this scenario. Any help is appreciated , Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2024 06:36 PM
@servicenow14710 In ServiceNow, the behavior you're describing occurs when you have multiple group approvals (using the sysapproval_group table) for a single approval request. When one group rejects the approval, its status is set to "rejected". However, when another group approves it, the entire approval request's status might change to "approved", affecting all related group approvals, including the previously rejected one.
This issue often arises due to the default logic in ServiceNow's approval engine, where the overall approval state is determined based on the most recent action. The default behavior does not account for individual group-level states if the overall request is updated.
As a solution consider using parallel approvals and customizing the rejection logic to halt the process if any group rejects.
Implement a Business Rule to enforce consistent approval states based on initial rejection.
Hope this will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2024 06:36 PM
@servicenow14710 In ServiceNow, the behavior you're describing occurs when you have multiple group approvals (using the sysapproval_group table) for a single approval request. When one group rejects the approval, its status is set to "rejected". However, when another group approves it, the entire approval request's status might change to "approved", affecting all related group approvals, including the previously rejected one.
This issue often arises due to the default logic in ServiceNow's approval engine, where the overall approval state is determined based on the most recent action. The default behavior does not account for individual group-level states if the overall request is updated.
As a solution consider using parallel approvals and customizing the rejection logic to halt the process if any group rejects.
Implement a Business Rule to enforce consistent approval states based on initial rejection.
Hope this will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2024 05:56 PM
Hello @Abhay Kumar1: Thanks for your reply, these group approvals are parallel even then im facing this issue.
i used condition based script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2024 09:28 PM
@servicenow14710 Setting answer to 'approved' just because not all groups rejected might be incorrect. Typically, you need to check if all groups have approved, not just that they haven't rejected.
You might want to include an 'in progress' or 'pending' state check in case not all approvals are completed.
For example:
if (workflow.scratchpad.totalCount == counts.total) {
if (workflow.scratchpad.totalRejectedCount == counts.total) {
// All groups rejected
answer = 'rejected';
} else if (workflow.scratchpad.totalApprovedCount == counts.total) {
// All groups approved
answer = 'approved';
} else {
// Some groups have not decided yet (pending state)
answer = 'pending';
}
}
Also add log to debug your code if still result is not expected from your script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 09:03 AM
Hello @Abhay Kumar1 , thanks for your suggestion. In our scenario even if one approved it should go to approved and all should be rejected to go to rejected
This script i used is for overall approval activity approved/rejected, group approval records are getting updated meanwhile. Thanks!