The CreatorCon Call for Content is officially open! Get started here.

Lock down Variables in Task after its submitted

Tom Thompson
Tera Expert

I have catalog items that have Reference fields that create tasks and for example

 

Change Group name pulls the Name in from Servicenow

When the tasks is created it has that old name but when the name is changed and the 1st tasks

is closed out then the next tasks to a different area to correct in there area gets a tasks and the new name

is in Reference field now. 

 

How do you stop the Reference fields from updating after submitting the REQ? 

16 REPLIES 16

Yes this is what I'm trying to do, Need to see old values also.  Not sure how to make it happen

Community Alums
Not applicable

Hi @Tom Thompson ,

 

  • Please create a new field of type String as shown below in your desired table. In my example I used Incident.

 

Madhansomesh_1-1708073989399.png

  • Now create an OnAfter Business as shown below to copy the assignment group name value as soon as the Incident is created.

Madhansomesh_2-1708074139312.png

Add the below code in your script section & that would store the assignment group name before it got renamed in the field we created.

The final output will look something like this & the value won't change as we are running the BR only on Insert.

 


 

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

	current.u_original_assignment_group = current.assignment_group.getDisplayValue();
	current.update();
	
})(current, previous);

 

Please mark it as "Accept as Solution" and " Helpful. if this solution helped you.


Thanks & Regards,
Madhan Somesh.


 

 

Community Alums
Not applicable

Hi @Tom Thompson ,

 

  • Please create a new field of type String as shown below in your desired table. In my example I used Incident.

 

Madhansomesh_1-1708073989399.png

  • Now create an OnAfter Business as shown below to copy the assignment group name value as soon as the Incident is created.

Madhansomesh_2-1708074139312.png

Add the below code in your script section & that would store the assignment group name before it got renamed in the field we created.

The final output will look something like this & the value won't change as we are running the BR only on Insert.

Madhansomesh_3-1708074847868.png

 

 

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

	current.u_original_assignment_group = current.assignment_group.getDisplayValue();
	current.update();
	
})(current, previous);

 

 

Please mark it as "Accept as Solution" and " Helpful. if this solution helped you.


Thanks & Regards,
Madhan Somesh.


you did this for incident and I need it for a catalog tasks where the Field name will be different each time..

Community Alums
Not applicable

Hi @Tom Thompson ,

 

You can do the same implementation for sc_task as well where you can copy the Assignment group field value from the reference field to the string field we created. 

 

If the field value changes we can add one more if before setting the value saying only if the reference field contains the group value then only proceed with setting the group name value as below.

 

if(variables.assignment_group)
{
	current.u_original_assignment_group = current.assignment_group.getDisplayValue(); //or whatever the field it is 
	current.update();
}

 

 

If still it's not working please provide me with a screenshot of the field/cat item from where the assignment group will be added.

 

Please mark it as "Accept as Solution" and " Helpful. if this solution helped you.


Thanks & Regards,
Madhan Somesh.