- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 08:16 PM
I am performing easy import on the custom table, but the string field from Excel' u_owner' is not getting mapped to the reference field 'Owner' on the target table. It is mapping the other fields but the owner field just does not get copied and leaves blank.
Need Urgent help on this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 12:09 AM
Hi @Mishu
Most probably because of this rule.
Name: user query
URL: https://<instance_name>/sys_script.do?sys_id=62a7bfaf0a0a0a6500c49682bd82376a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 11:59 PM - edited 10-05-2023 12:00 AM
@Ankur Bawiskar - I observed that when it's an active user the value is getting mapped in target table, but in case of locked out/inactive user it is coming blank after import, but customer want the inactive user also to be displayed on data import...i have not used any reference qualifier or any validation to remove inactive users to be selected or displayed, What could be the issue it is not showing up ?
In below screenshot 'Abrahim' was an active user so it shows up but other record the value is empty as i tried with inactive users.
Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 12:09 AM
Hi @Mishu
Most probably because of this rule.
Name: user query
URL: https://<instance_name>/sys_script.do?sys_id=62a7bfaf0a0a0a6500c49682bd82376a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 12:18 AM
@Tai Vu -- Checking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 12:34 AM
It worked now !! Thanks much 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 08:47 PM
HI @Mishu ,
I trust you are doing great.
When you're importing data into a reference field in ServiceNow, the system doesn't look for the display value (like a string from your Excel). Instead, it expects the sys_id of the referenced record. If you're trying to import a string value into a reference field, it won't work directly.
Here's how you can address this:
(function transformEntry(source, target, map, log, isUpdate) {
var ownerName = source.u_owner.toString();
var ownerSysId = '';
// Query the user table to get the sys_id based on the user's name or any other unique identifier
var userGR = new GlideRecord('sys_user');
userGR.addQuery('name', ownerName); // Adjust the field name as per your instance
userGR.query();
if (userGR.next()) {
ownerSysId = userGR.sys_id.toString();
}
// Set the sys_id to the reference field
target.owner = ownerSysId;
})();
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi