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

How to set a string value field on one table same as a reference value field on another table?

Suchismita
Tera Contributor

Hello,

Can anyone help me with the logic to set a string value field on one table same as a reference value field on another table?

Scenerio:

I have two fields: 'assigned to' is a reference field in one table & 'Ops lead' is a string field in another table.

'Ops lead' need to be same as 'assigned to' and if assigned to is changed, the other needs to replicate.

 

Any assistance would be extremely helpful and appreciated.

I am self taught scripter so I'm novice.

 

Thank You

1 ACCEPTED SOLUTION

@Suchismita 

 

try below script:

var gr = new GlideRecord("SECOND_TABLE_NAME");

gr.addQuery("sys_id", current.getValue(("NUBMER_FIELD_BACKEND_NAME"));

gr.query();

if(gr.next()){

gr.OPS_LEAD_FIELD_NAME = current.getDisplayValue("ASSIGNED_TO_FIELD_NAME");

gr.update();

}

 

Note: update field names in above script as in your table.

 

Thank you,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

View solution in original post

6 REPLIES 6

@Suchismita 

 

try below script:

var gr = new GlideRecord("SECOND_TABLE_NAME");

gr.addQuery("sys_id", current.getValue(("NUBMER_FIELD_BACKEND_NAME"));

gr.query();

if(gr.next()){

gr.OPS_LEAD_FIELD_NAME = current.getDisplayValue("ASSIGNED_TO_FIELD_NAME");

gr.update();

}

 

Note: update field names in above script as in your table.

 

Thank you,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

Thank you @Ahmmed Ali  its working.