How to sync the assignment group of the RITM and Catalog Task?

aimughal
Tera Contributor

When a Task is created, how can I keep the Assignment group field in sync with the RITM assignment group field.

 

update: as in synced at all times, if the ritm assignment group is updated then the task should be updated too

1 ACCEPTED SOLUTION

Hi @aimughal,

 

No worries, so it should be the other way around - Sync RITM's assignment group from the SCTASK? You can use the same condition but change the Table to Catalog task and use the script below:

(function executeRule(current, previous /*null when async*/) {

	var ritmGr = new GlideRecord("sc_req_item");
	ritmGr.get(current.getValue('request_item'));
	if(ritmGr.isValidRecord())
	{
		ritmGr.setValue('assignment_group', current.getValue('assignment_group'));
		ritmGr.update();
	}

})(current, previous);

 

Just a reminder, I don't think this is a good process and I recommend revisiting it.

 

Thanks

 

 

View solution in original post

9 REPLIES 9

Could you demonstrate what the br should be like/how it should be implemented?

Or would an 'on change' script work? 

This is required so the SLA is up to date with the latest task group. 

Writing a BR would be pretty straightforward.

Condition will be:

JamesChun_1-1708028015783.png

 

And the script, you can write something like:

(function executeRule(current, previous /*null when async*/) {

	var sctaskGr = new GlideRecord('sc_task');
	sctaskGr.addEncodedQuery('request_item=' + current + '^active=true');
	sctaskGr.query();
	while(sctaskGr.next())
	{
		sctaskGr.setValue('assignment_group', current.getValue('assignment_group'));
		sctaskGr.update();
	}

})(current, previous);

 

BUT this doesn't mean you should be doing this, your requirement does not justify the need. I don't understand what you meant by "SLA is up to date with the latest task group." . 

 

Thanks

Hi James, thanks for the prompt response.

Update: it is working when I change the group on the ritm, then the task is updated. Thank you.

However I need it to only update the group on the ritm, when it's changed on the task. What would the BR script look like in this case?

 

thank you

Hi @aimughal,

 

No worries, so it should be the other way around - Sync RITM's assignment group from the SCTASK? You can use the same condition but change the Table to Catalog task and use the script below:

(function executeRule(current, previous /*null when async*/) {

	var ritmGr = new GlideRecord("sc_req_item");
	ritmGr.get(current.getValue('request_item'));
	if(ritmGr.isValidRecord())
	{
		ritmGr.setValue('assignment_group', current.getValue('assignment_group'));
		ritmGr.update();
	}

})(current, previous);

 

Just a reminder, I don't think this is a good process and I recommend revisiting it.

 

Thanks

 

 

thanks so much!