Announcing the Global SNUG Board of Directors. Learn more here

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy field value from one table to another

saurabhsharma
Giga Contributor

Hi

I have created a field on change task table name as "Customer". Now I want whenever a change task is created from change , Value of "Assigned to" in change form should copy in Customer field of change task form.

Thanks & Regards,

Saurabh

1 ACCEPTED SOLUTION

Varsha21
Mega Guru

Hi write

BR on change_task table like

After insert,update

condition like assigned_to is not empty

and script

like bellow,

change field name according to your requirement

 

	var a=current.assigned_to.getDisplayValue();
	gs.addInfoMessage(a);
	var gr=GlideRecord('change_request');
	gr.addQuery('number',current.change_request.number);
	gr.query();
	if(gr.next())
		{
		//	gs.addInfoMessage(gr.requested_by);
	        gr.u_customer.setValue(a);
		    gr.update();
		}

 

worked for me

 

Thank you

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Saurabh,

recommended method:

1) before insert business rule on change_task table with below script and condition as current.change_request != ''

current.<customerField> = current.change_request.assigned_to;

use proper field names there;

customerField -> your customer column name

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards
Ankur

Varsha21
Mega Guru

Hi write

BR on change_task table like

After insert,update

condition like assigned_to is not empty

and script

like bellow,

change field name according to your requirement

 

	var a=current.assigned_to.getDisplayValue();
	gs.addInfoMessage(a);
	var gr=GlideRecord('change_request');
	gr.addQuery('number',current.change_request.number);
	gr.query();
	if(gr.next())
		{
		//	gs.addInfoMessage(gr.requested_by);
	        gr.u_customer.setValue(a);
		    gr.update();
		}

 

worked for me

 

Thank you