- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2022 01:17 AM
I have a business rule written that whenever a P1/P2 incident is resolved then a problem ticket will be created automatically. The problem ticket is being generated correctly, but there are some cases where duplicate problem records are being created with different problem numbers.
What condition should I put in my BR to avoid creation of duplicate problem records?
(function executeRule(current, previous /*null when async*/) {
var prob = new GlideRecord("problem");
prob.short_description = current.short_description;
prob.u_business_service = current.u_business_service;
prob.cmdb_ci = current.cmdb_ci;
prob.priority = current.priority;
prob.description = current.description;
prob.opened_by = current.opened_by;
prob.assignment_group = "712cc9bb0ff28600b11cf68ce1050ec1";
prob.state = 2;
prob.parent = current.sys_id;
prob.sys_domain = current.sys_domain;
var sysID = prob.insert();
current.problem_id = sysID;
var mySysID = current.update();
gs.addInfoMessage("Problem " + prob.number + " created");
action.setRedirectURL(prob);
action.setReturnURL(current);
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2022 01:28 AM
Just execute your code inside the if {} in below code
if (current.problem != ""){
Your code here
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2022 01:23 AM
Configure hte Business rule to run After instead of Before.
Also, only Update would suffice your need no need of Insert.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2022 03:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2022 01:28 AM
Just execute your code inside the if {} in below code
if (current.problem != ""){
Your code here
}