to avoid to create duplicate problem records from the major incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 02:29 AM
I have a business rule written that whenever a P1/P2/Managed P3 incident is resolved then a problem record will be created automatically. The problem record is being generated correctly (like major problem will create for P1/P2 incidents is resolved and non-major problem will create for Managed P3 incident is resolved), but there are some times 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?
*Please find the attached screen shot of when to run business rule conditions.
Business Rule is below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:05 AM
you can check if problem already exists for this INC
something like this
(function executeRule(current, previous /*null when async*/ ) {
var prob = new GlideRecord("problem");
prob.addQuery('first_reported_by_task', current.sys_id);
prob.query();
if (prob.hasNext())
return;
else {
prob.initialize();
prob.first_reported_by_task = current.sys_id;
prob.short_description = current.short_description;
prob.description = current.description;
prob.cmdb_ci = current.cmdb_ci;
prob.impact = current.impact;
prob.urgency = current.urgency;
prob.u_category = current.category;
prob.business_service = current.business_service;
if (current.major_incident_state == "accepted" && (current.priority == 1 || current.priority == 2)) {
prob.major_problem = true;
prob.assignment_group = gs.getProperty('command.centre.incident.communications');
} else {
prob.major_problem = false;
prob.assignment_group = current.assignment_group;
}
prob.u_caused_by_change = current.caused_by;
prob.priority = current.priority;
prob.company = current.company;
prob.sys_domain = current.sys_domain;
prob.insert();
var sysID = prob.sys_id;
current.problem_id = sysID;
current.setWorkflow(false);
current.update();
current.setWorkflow(true);
gs.addInfoMessage("Problem " + prob.number + " has been created.");
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 08:06 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:06 AM
whenever a Major incident is getting resolved, then system creates a problem record automatically.
This is OOTB behavior.
it comes from this playbook "Major Incident Process", You can see after Resolve step, it's creating Problem Record
In the Step 8 it calls this "Major Incident Playbook - Create a Problem from Incident" subflow
This subflow calls another flow action "Create Problem Record from Incident" where the problem is created
1) Subflow
2) Action
1) either deactivate that subflow
OR
2) Remove that Step 8, remember you will have to update the playbook in the correct scope
OR
3) Update that flow action
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:09 AM
Thank you. Let me check on this code.