I want to create 5 incident tasks whenever priority field changes to critical
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2024 03:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 10:55 PM
 
I have created like this, it's creating only one incident task record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2024 07:26 AM
Hi @JayachandrReddy ,
use async business rule on incident table, use below code.
// Check if priority is set to Critical
if (current.priority == 1) {
for (var i = 0; i < 5; i++) {
var task = new GlideRecord('incident_task');
task.initialize();
task.incident = current.sys_id;
task.short_description = 'Follow up task for Critical priority incident';
task.priority = 1; // Set task priority to Critical
task.insert();
}
}
Accept and like the solution if it helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2024 07:56 AM
You can use a business rule to run when Priority Changes to 1 - Critical
You can also use the following Condition current.priority.changesTo('1');
You can also put an if in the script to check for that condition.
var numberOfTasks = 5;
var shortDescription = "Critical Incident task";
for (var i = 0; i < numberOfTasks; i++) {
var task = new GlideRecord('incident_task');
task.initialize(); task.parent = current.sys_id;
task.short_description = shortDescription; task.insert();
}
Add any logging necessary if you'd like.
Please mark helpful if you found it to be.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2024 08:04 AM
@JayachandrReddy you achieve it with flow designer. please find more details in bellow course.
Please mark my answer correct and helpful if this works for you.