- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 07:26 PM
Hi,
Incident should not resolved if any task are pending or open. once all the tasks are closed then only Incident can close/Resolved.
For example:
In an Incident there are 3 tasks are there if 2 tasks are closed and one is open/pending then if i close that incident it will not going to close.
Once all the tasks are closed then only Incident is get closed.
Please help me on the same.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2019 12:05 AM
Hi,
Try with below code
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr=new GlideRecord('incident_task');
gr.addQuery('incident',current.sys_id);
gr.addQuery('active',true);
gr.query();
if(gr.next())
{
current.setAbortAction(true);
gs.addInfoMessage("incident can not be closed untill all incident tasks should be closed or resolved");
}
}
Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 08:24 PM
You need to write a "on before" update business rule. In this business rule, write a script to query the incident task table with a filter as status is not closed. If the script returns any record then you need to set the script to abort the update action and show an error message that the related task is open.
-harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 09:13 PM
Hi,
Could please provide me the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 10:41 PM
Hi Veer raju,
Write Before update Business rule on incident table
And put condition as state changes to Resolved
write below script in script field
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr=new GlideRecord('incident_task');
gr.addQuery('incident',current.sys_id);
gr.query();
if(gr.next())
{
current.setWorkflow(false);
gs.addInfoMessage("incident can not be closed untill all incident tasks should be closed or resolved");
current.setAbortAction(true);
}
})(current, previous);
Mark correct/helpful if it helps for you
Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2019 11:15 PM