
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:39 AM
Hi Community,
I got the data from client were they have provided the reference of other field of the table. For example-
I have reference field as Asset which is referring to the name field of Asset Table. There is one field called serial number of which client has provided the data in sheet. I tried mapping and tried transform map script as well using gliderecord as below-
var gr= new GlideRecord('x_asset'); //x_asset is asset table name
gr.addEncodedQuery('serial_no='+source.serial_no.); //serial_no is serial number field in asset table
gr.query();
if(gr.next())
{
target.asset = gr.name;
target.update();
}
Note source field is also mapped to target field
Can someone please help me what i am missing?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:47 AM
Hi @Shubham Bongulw,
Are you updating asset reference field? try by replacing the line
target.asset = gr.getUniqueValue();
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:47 AM
Hi @Shubham Bongulw,
Are you updating asset reference field? try by replacing the line
target.asset = gr.getUniqueValue();
Thanks,
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:50 AM
Yes Sagar I am trying to update reference field. Let me try your solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:54 AM
Thankyou Sagar it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:52 AM
you should set the sysId of the record.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader