- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 08:08 AM
All,
I need to generate a Problem Record when an incident is classified as a priority 1. I've tried using a client script to call the oob create problem ui action, but I would like this to happen in the background. Anybody have a script that does this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 11:30 AM
You are welcome.
Kindly mark answer as correct / helpful if it solves your problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 08:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 08:19 AM
Hi,
Create After Insert business rule
condition : current.priority == 1;
var gr = new GlideRecord('problem');
gr.initialize();
gr.short_description = current.short_description;
// you can set other fields also based on above code or can refere to create problem UI action code as well
if(gr.parent.nil())
{
gr.insert();
}
Do it in some demo instance or sandbox and check completely.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 08:28 AM
You can add modified code as follow
After insert / update business rule
condition :
current.incident_state != 7 && current.problem_id.nil() && current.priority == 1
var prob = new GlideRecord("problem");
prob.short_description = current.short_description;
prob.cmdb_ci = current.cmdb_ci;
prob.priority = current.priority;
prob.company = current.company;
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2016 09:03 AM
Thanks for the info!
One minor adjustment that we needed to make was to have the PRB created when:
The incident was Inserted and Updated and the priority was updated and the priority is 1 - critical.
We needed to do this because when we closed the PRB, it would update the associated Inc, which would then spawn another PRB.