- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2024 04:11 AM
I have a requirement of parallel sc task creation based on category selected on Request.
Here category is list collector
If multiple categories are selected then multiple sc tasks to be created.
How can we achieve through workflow ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2024 05:24 AM
Hi @Balakrishna_ABK ,
Create a Business Rule that triggers when a request record is inserted or updated. This Business Rule will create parallel tasks.
(function executeRule(current, previous) {
if (current.operation() == 'insert' || current.operation() == 'update') {
var categories = current.category; // Assuming 'category' is the list collector field
for (var i = 0; i < categories.length(); i++) {
var category = categories.getRef(i);
var task = new GlideRecord('sc_task');
task.initialize(); // Initialize a new task record
task.setValue('category', category); // Set category field value
// Set other task fields as needed
task.insert(); // Insert the new task record
}
}
})(current, previous);
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2024 05:24 AM
Hi @Balakrishna_ABK ,
Create a Business Rule that triggers when a request record is inserted or updated. This Business Rule will create parallel tasks.
(function executeRule(current, previous) {
if (current.operation() == 'insert' || current.operation() == 'update') {
var categories = current.category; // Assuming 'category' is the list collector field
for (var i = 0; i < categories.length(); i++) {
var category = categories.getRef(i);
var task = new GlideRecord('sc_task');
task.initialize(); // Initialize a new task record
task.setValue('category', category); // Set category field value
// Set other task fields as needed
task.insert(); // Insert the new task record
}
}
})(current, previous);
Thanks,
Ratnakar