How to create a problem automatically when an incident is registered with P1 priority?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:32 AM
Hi folks,
I have a requirement where i want to register a problem ticket automatically by the system when a P1 incident is created. How can i implement it?
Any suggestions would be greatly appreciated.
Thanks
PG
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:36 AM
Create a new business rule on the Incident table. It would run in the context of After. The condition would be "Priority > Changes to > P1." Just use a GlideRecord to create the Problem and build a relationship between the new PRB and the INC.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:37 AM
Hi Pradeep,
An INSERT business rule will work. Run it AFTER the incident is created.
Table: incident
Advanced: true
Insert: true
Update: true (if you want to capture those that change from P2-4 to P1)
When: After
conditions: current.priority.changesTo(1)
Script:
var prb = new GlideRecord('problem');
prb.newRecord();
prb.short_description = current.short_description;
// copy other fields here as needed
prb.insert()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:47 AM
Thanks a lot Chuck. It is quite helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:48 AM
Sorry, I forgot to set up the relationship between the problem and incident (and a semicolon - and my standard disclaimer)
var prb = new GlideRecord('problem');
prb.newRecord();
prb.short_description = current.short_description;
// copy other fields here as needed
var pid = prb.insert();
current.problem = pid;
current.setWorkflow(false); // don't trigger business rules
current.update(); // NORMALLY BAD PRACTICE, but required here