
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2017 11:33 PM
Hi Guys,
Let me know how to get mandatory approvals from two people in a workflow and until the two of them approve, it should be 'Requested' and once both of them approve then only it should be 'No longer required'. If the first person has approved, still it should be in Requested state until one more person approves and then no longer required.
How do I achieve this from a workflow ?
Thanks,
Utkarsha Saxena
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 12:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 12:22 AM
Please ignore my code, i read your wrongly. i was in the impression that if approval count is two then move the workflow ahead. Let me check how to get your requirement done.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 12:34 AM
Not sure about workflow, never tested there but I think you can do it through after update Business Rule on sysapproval_approver table. try if this helps.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', parent.sys_id);
gr.addQuery('approver', gs.getUserID());
gr.query();
if(gr.getRowCount()>=2)
{
current.state = 'not_required';
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 01:33 AM
Hi,
So along with making this Business Rule on approval table on after update, do we also need to make some changes at the workflow level. Like for example, in the workflow, there are group approvals and individual approvals. I want this to happen for the group approval, so do I need to change the approval condition at the workflow and make it to 'everyone to approve' as well ?
Also, how do I link this business rule to the workflow which drives the approvals ?
Thanks,
Utkarsha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 01:48 AM
I don't think any changes are required from the workflow side but you can have the condition based on script as suggested by rajmasurkar.
You do not need to link the BR with workflow that will be executed automatically when any two approvals get done for that task on sysapproval_approver table.
Please try and check if this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 01:56 AM
Hi Shishir,
Actually the workflow runs on the change request table for the changes in the change request form and approval table is needed for some approvals that are generated through email notifications.
That is why, I have not made any business rule for this workflow.
I tried doing the code that Raj suggested for the workflow but even after getting two approvals, it didn't stop and become 'No longer required'. How to stop it for that group activity ?
Thanks,
Utkarsha