- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 11:27 PM
I have an issue with problem records, when I click on resolve, the problem record is closing directly without checking the active open problem tasks, I need to stop the problem resolving, problem resolve will happen only when the active/open tasks are closed, please help us with the solution.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 11:31 PM
Hi Pavan,
You can achieve this by using before update Business rule.
In When to run add the condition as 'State changes to Resolved'
and in the Advanced tab, write the below code:
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("problem_task");
gr.addActiveQuery();
gr.addQuery("problem", current.sys_id);
gr.query();
if (gr.next()) {
gs.addErrorMessage("Please close the open Problem tasks to proceed to Resolved state");
current.setAbortAction(true);
}
})(current, previous);
Please hit like/Accept as Solution, if it works for you.
Thanks,
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 11:31 PM
Hi Pavan,
You can achieve this by using before update Business rule.
In When to run add the condition as 'State changes to Resolved'
and in the Advanced tab, write the below code:
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("problem_task");
gr.addActiveQuery();
gr.addQuery("problem", current.sys_id);
gr.query();
if (gr.next()) {
gs.addErrorMessage("Please close the open Problem tasks to proceed to Resolved state");
current.setAbortAction(true);
}
})(current, previous);
Please hit like/Accept as Solution, if it works for you.
Thanks,
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 11:38 PM
Excellent, Thanks harish! Solution is worked.
In my question, some glitch is there, but you have understood the issue and provided the solution, thanks for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 11:34 PM
Hi @PavanKumar Raja ,
You can try below BR on problem table
Before Update
State changes to closed
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var grProblemTask = new GlideRecord('problem_task');
grProblemTask.addEncodedQuery("active=true^problem="+current.sys_id);
grProblemTask.query();
if (grProblemTask.next()) {
gs.addInfoMessage(gs.getMessage("Please close the task before closing the problem ticket."));
current.setAbortAction(true);
}
})(current, previous);