how to update the User Name by using User ID through Data load?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 10:13 AM
how to update the User Name by using User ID through Data load?
Hi ,
Please suggest me on the below request:
I'm loading data through Data Source(Import set table)
I'm passing value as User ID to User field -, but in form i want to show the User Name not the user Id for this need to write any transform script on the transform map or any other way ?
Example User ID - 103452 (" sys_user" table )
User - Sai (user field need to update with "Sai" not with "103452 "(user id).
i uploaded the file, its updating with User ID only not with Name.
Please let me know if any one knows the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 10:19 AM
Hi,
Are you mapping the user id it to a reference field? The display value on user table is OOB the name field. Have you changed the display value of user table?
Can you please share a screenshot of your user id field map?
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 10:27 PM
I'm passing User Id in Excel sheet to Source table "10070883", so what i need is in target table i want to show the name of that user ID.
please refer the below screenshots. (expected in target table.)
Both ( source and target) "Assigned To" fields is Refereing to "sys_user" table only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 11:08 PM
Hi Sowmya,
Instead of mapping the source field to the target field, you could Use source script. Just set that flag to true and in that query the user table with User ID from source table and then set the target field value to the corresponding username.
answer = (function transformEntry(source) {
// Add your code here
var _user = new GlideRecord("sys_user");
_user.addQuery("user_id", source.getValue('u_user_id'));
_user.query();
if (_user.next()) {
return _user.name; // return the value to be put into the target field
}
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2017 12:56 AM
Hi Sowmya,
You might have missed to update the value for reference value field name in your field map for Assigned to and hence the value is not updating correctly. You don't require source script for this, please see the screenshot and let me know if this works out.
Make sure you update it to the column name of User Id in your user table. It is user_name oob.
http://wiki.servicenow.com/index.php?title=Creating_New_Transform_Maps#Creating_a_Field_Map
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response