How to add and remove multiple service offerings in list field type from Incident which is updated in related list?

Vijaya13
Tera Contributor

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

 

find_real_file.png

 

 

find_real_file.png

 

 

2 REPLIES 2

MrMuhammad
Giga Sage

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

Regards,
Muhammad

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

Regards,
Muhammad