Create multiple task using business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2022 01:22 AM
Hi Everyone,
I am creating task using business rule on case table. But my requirement is to create multiple task based on drop down. I have field on case table call "tasks" , it is a drop down field. Based on value I choose from that field the tasks must be created. Please help to create array for this task.
BR:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var cs = new GlideRecord("sn_customerservice_task");
cs.initialize();
cs.parent = current.getUniqueValue();
cs.description = current.short_description;
cs.priority = current.priority;
cs.assignment_group = current.assignment_group;
cs.assigned_to = current.assigned_to;
cs.insert();
})(current, previous);
Thanks in advance
cc: @Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2022 02:53 AM
Can you check if the table on BR you selected is sc_req_item, and when to run condition is after insert? can you provide the exact code/ BR screenshot please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2022 01:33 AM
What are the values of the dropdown ?? what should be the behavior when value changes ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2022 01:39 AM
Hi,You achieve through many ways. I'm just explaining below approach. Create a workflow based on your requirement i.e, create many tasks and create a new task based on existing task closure. You should call the workflow in business rule
wrkflw.startFlow(wflw.getWorkflowFromName('Call WF toBR'),current,current.operation());
Create a flow designer based on the do above actions.
Regards,
Suresh.
Suresh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2022 03:22 AM
Can you try this?
var task_count = ParseInt(current.u_tasks);
for (var i = 0; i < task_count; i++); {
var cs = new GlideRecord("sn_customerservice_task");
cs.newRecord();
cs.parent = current.getUniqueValue();
cs.short_description = current.short_description;
cs.priority = current.priority;
cs.assignment_group = current.assignment_group;
cs.assigned_to = current.assigned_to;
cs.insert();
}
Please mark this response as correct or helpful if it assisted you with your question.