problem should not resolve if associated ptask is open
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I want to create business rule like if the problem associated Ptask is not resolved then problem should not be resolved.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ashimghosh1 ,
As suggested it can be achieved via before business rule
Name : Restrict Problem Resolution with Open Tasks
Table: Problem [problem]
Advanced : Checked
When :Before
Update : Checked
(function executeRule(current, previous /*null when async*/) {
var taskGR = new GlideRecord('problem_task');
taskGR.addQuery('problem', current.getUniqueValue());
taskGR.addActiveQuery();
taskGR.setLimit(1 );
taskGR.query();
if (taskGR.next()) {
gs.addErrorMessage('Cannot resolve this Problem because one or more associated Problem Tasks are still open.');
current.setAbortAction(true);
}
})(current, previous);
For a low code alternative approach
- Go to Flow Designer → Create New Flow
- Trigger = Record Updated → Table = problem → Condition = State changes to Resolved
- Action = Look up Records on problem_task where:
- problem = trigger record
- state != resolved (i.e. open or in progress tasks exist)
- If results found → Use Update Record action to revert problem state back to In Progress
Thanks
Aanchal