- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 08:24 PM
Is there a way we can prevent users from closing a Problem unless it is approved by the Group Manager?perhaps through a role, a business rule?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 08:50 PM
Thanks for the update.
You have to create a before business rule on problem table and have filter condition to execute when problem state is change to closed (So that the BR is fired only in this case).
Script :
var grpManager = current.assignment_group.manager;
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.addQuery('approver', grpManager);
gr.addQuery('state', 'approved');
gr.query();
if(!gr.next())
{
gs.addErrorMessage('YOUR MESSAGE');
current.setAbortAction(true);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 08:28 PM
Hi Noman,
You mean approvals are triggered for the prb? Is there any field you have which sets to approved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 08:35 PM
THanks Pradeep.
The issue is that users aren't waiting for the problem to be approved before they close it.
Although yes, approvals are triggered, but if they're not approved on time, then users with the problem management role approve them (even though they're not approvers themselves, but assigned to those problems).
Hope this helps
Nomaan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 08:50 PM
Thanks for the update.
You have to create a before business rule on problem table and have filter condition to execute when problem state is change to closed (So that the BR is fired only in this case).
Script :
var grpManager = current.assignment_group.manager;
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.addQuery('approver', grpManager);
gr.addQuery('state', 'approved');
gr.query();
if(!gr.next())
{
gs.addErrorMessage('YOUR MESSAGE');
current.setAbortAction(true);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 10:23 PM
I have a simple suggestion. Why show the button or the action if the user is not allowed to act on it?
If the user is not allowed to close before approval, dont show the button. Have the above check on the button rather than a business rule