- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 03:14 AM
Hi team, I wanted to load data into servicenow Employee profile table from Excel sheet using import set and transform map process.
But in Excel user skill column contains multiple skills, but in the system it will table one record each time. how to split the data having multiple skills and load into service now tables.
I have Excel sheet and ServiceNow profile table
ID | Name | Manager | User Role | User Skill |
123456 Testuser testmanager developer java,.net
I want to upload above format skill data into primary resource skill field. this field is refer to cmn_skill table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 10:34 AM
Hello @Siva vittanala ,
So you have added this as an onAfter Transform Script on the Transform Map that has "Employee Profile" as the target table, correct?
If so then you need to change the line that assigns the "userId" value, because "target" is the Employee Profile record and the user is referenced in its "user" field:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var skillNames = source.getValue('u_user_skill').split(',');
var userId = target.getValue('user');
skillNames.forEach(skillName => {
var gr = new GlideRecord('sys_user_has_skill');
gr.addQuery('user', userId);
gr.addQuery('skill.name', skillName);
gr.query();
if (gr.hasNext()) return;
gr.initialize();
gr.setValue('user', userId);
gr.setDisplayValue('skill', skillName);
gr.insert();
});
})(source, map, log, target);
Your script was assigning the sys_id of the Employee Profile to "userId", which resulted in the issue.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 04:37 AM
We can create multiple records for each skill. Like for one user multiple records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 04:51 AM
Hello @Siva vittanala ,
Which records are you referring to?
Employee Profiles? No, it's not possible to create multiple profiles for the same user:
Or are you talking about User Skills [sys_user_has_skill]? That's the solution I was talking about in my previous response already. So I'm not sure what you're trying to say.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 10:00 AM
I have to update the skills on sys_user_has_skill table i am using this below script
but only employee profile table fields was getting updated not in sys_user_has_skill table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 10:34 AM
Hello @Siva vittanala ,
So you have added this as an onAfter Transform Script on the Transform Map that has "Employee Profile" as the target table, correct?
If so then you need to change the line that assigns the "userId" value, because "target" is the Employee Profile record and the user is referenced in its "user" field:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var skillNames = source.getValue('u_user_skill').split(',');
var userId = target.getValue('user');
skillNames.forEach(skillName => {
var gr = new GlideRecord('sys_user_has_skill');
gr.addQuery('user', userId);
gr.addQuery('skill.name', skillName);
gr.query();
if (gr.hasNext()) return;
gr.initialize();
gr.setValue('user', userId);
gr.setDisplayValue('skill', skillName);
gr.insert();
});
})(source, map, log, target);
Your script was assigning the sys_id of the Employee Profile to "userId", which resulted in the issue.
Regards,
Robert