Auto-create Problem Task (PTASK) for P1 & P2 Problems – Best Practice Configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Business Requirement
- When a Problem record is created
- If Problem Priority = P1 or P2
- System should automatically create a Problem Task (PTASK)
- Assignment Group & Assigned To on the PTASK should be inherited from the resolver group of the related P1 / P2 Incident
- No PTASK should be created for P3 / P4 Problems
- Duplicate PTASKs should be avoided
can any one please provide the configuration steps
@Ehab Pilloor .could you please help me here with steps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @nameisnani
Create an After insert, update BR for it.
- Table: Problem (problem)
- When: After
- Insert: Checked
- Update: Unchecked
- Condition: Priority is one of P1 or P2
(function executeRule(current, previous /*null when async*/) {
var relatedIncident = new GlideRecord('incident');
if (relatedIncident.get(current.rfc)) {
var assignmentGroup = relatedIncident.assignment_group;
var assignedTo = relatedIncident.assigned_to;
var pTaskGr = new GlideRecord('problem_task');
pTaskGr.addQuery('problem', current.sys_id);
pTaskGr.addQuery('assignment_group', assignmentGroup);
pTaskGr.addQuery('assigned_to', assignedTo);
pTaskGr.query();
if (!pTaskGr.hasNext()) {
var newTask = new GlideRecord('problem_task');
newTask.initialize();
newTask.problem = current.sys_id;
newTask.assignment_group = assignmentGroup;
newTask.assigned_to = assignedTo;
newTask.short_description = 'Investigate P1/P2 Incident root cause'; // Customize as needed
newTask.insert();
}
}
})(current, previous);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @nameisnani,
You can use Flow Designer to create PTask for creation of P1 or P2 Problem or an after insert BR as Tanushree mentioned.
Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If you use Flow Designer,
Set record based trigger, only for record created. Condition will be Priority is P1 or Priority is P2. Use Create record action, table = PTask.
Autofill values for PTask fields using data pills from Problem record.
Set the correct State.
Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago