Reference variable copying

vsxacvxjhsgvxck
Tera Contributor

How can we copy reference variable to other reference variable?

2 REPLIES 2

Community Alums
Not applicable

Arun_S1
Tera Guru
Tera Guru

@vsxacvxjhsgvxck The solution depends on when & from where you wanted to copy the reference variable.

 

If you are referring to a service catalog/record producer which has 2 reference variables (requested_by & requested_for) to the sys_user table and you wanted to copy the value selected in one reference field to another.

 

Please create a client script of type "onChange" for the variable name "requested_by" and add the below script. Please adjust the field names according to your requirement.

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	g_form.setValue('requested_for',newValue)

   //Type appropriate comment here, and begin script below
   
}

Please mark the appropriate response as correct answer and helpful.

Thanks!!