- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 01:39 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:49 PM
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
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 02:32 AM
Hello @Suchismita
Write after update business rule on table where assigned to field exists. update condition as assigned_to changes write the script as below:
var gr = new GlideRecord("SECOND_TABLE_NAME");
//add query to get the particular record you want to update here
gr.query();
if(gr.next()){
gr.OPS_LEAD_FIELD_NAME = current.getDisplayValue("ASSIGNED_TO_FIELD_NAME");
gr.update();
}
Note: add relevant query in above script.
OR let me know how both tables are related.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:07 PM
@Ahmmed Alican you please help me with the query?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:15 PM
Hello @Suchismita
How is the second table linked to first table? is there any reference field in first table referring to second table. Then whenever assigned to in first table changes, the record selected in that reference field Ops lead field should be changed to new value. If yes, then let me know the field name of that reference field.
else explain how those are related and then we can build query.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:26 PM
There is another reference field ( Number) in 'assigned to' field's table which shows the second ( ops lead) table.
Both 'assigned to' and 'ops lead' are reference fields having the same values but in two different tables.
Is it enough to get the relevant query ?
Thank You,
Suchismita