How to add and remove multiple service offerings in list field type from Incident which is updated in related list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2022 04:05 AM
I would like to add and remove multiple service offerings in list field type from service offerings added in incident related list.
Like Users will add the different service offerings from the incident related list and these data should be added automatically in new fields called Affected Territories. Even when service offerings removed from related list

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2022 11:54 AM
Hi,
Please try something like the below.
After Update & Delete BR.
Condition: Task.task Type [is] incident
Advance Checkbox - checked
Script
(function executeRule(current, previous /*null when async*/) {
var affectedTerroritiesList = [];
var incGr = "";
var taskGr = new GlideRecord("task_service_offering");
taskGr.addQuery("task", current.getValue("task"));
taskGr.query();
while (taskGr.next()) {
incGr = taskGr.task.getRefRecord();
affectedTerroritiesList.push(taskGr.getValue("sys_id"));
}
incGr.<name_of_custom_field> = affectedTerroritiesList.join(","); // Replace with Affected Territories field.
incGr.update();
})(current, previous);
Hope that helps!
Regards,
Muhammad
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2022 01:51 AM
Hi Vijaya,
If your question has been answered then please close the thread by marking the appropriate response as correct to help future users.
Regards,
Muhammad
Muhammad