- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 11:09 PM
Hi Team,
On INCIDENT Table, there's a custom field drop-down 'Primary Root Cause' and if drop down value is chosen as 'To be investigated via PROBLEM record' , it automatically creates a PROBLEM record on Resolution of Incident. The problem is if we have 'x' number of Child Incidents linked with a PARENT INCIDENT, it creates 'x' number of Problem tickets because the primary root cause field value flows from Parent incident to Child incident.
The requirement is -
If there are child incidents attached to a Parent incident, and the Primary Root Cause is chosen as To be investigated via PROBLEM record, it should only create 1 Problem record, and all the subsequent child incidents should get attached to this Problem ticket.
How can we achieve this via a Business rule?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 09:48 PM
Hi Rookie,
Please try this code in your BR on Incident table, remove the condition Problem is empty in your condition and check that in code directly. -
if(current.problem_id == ""){
var generateProblem = new CreateProblemFromIncident();
generateProblem.createProblem();
current.update();
}
if(current.problem_id != "")
{
var chkNum = new GlideRecord('incident');
chkNum.addQuery('parent_incident',current.sys_id);
chkNum.query();
while(chkNum.next()){
chkNum.problem_id = current.problem_id;
chkNum.update();
}
}
Kindly mark helpful/resolved if it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 09:48 PM
Hi Rookie,
Please try this code in your BR on Incident table, remove the condition Problem is empty in your condition and check that in code directly. -
if(current.problem_id == ""){
var generateProblem = new CreateProblemFromIncident();
generateProblem.createProblem();
current.update();
}
if(current.problem_id != "")
{
var chkNum = new GlideRecord('incident');
chkNum.addQuery('parent_incident',current.sys_id);
chkNum.query();
while(chkNum.next()){
chkNum.problem_id = current.problem_id;
chkNum.update();
}
}
Kindly mark helpful/resolved if it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 09:49 PM
Woah, that worked Sanbir.
Thanks for your help!