- 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 03:25 AM
then don't give field map, handle everything using onBefore transform script
for each row get the number of skills how many are there in that excel column and create those many records into target table using for loop and GlideRecord
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 04:41 AM
Could you please provide script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 04:47 AM
please check response from @Robert H
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 03:40 AM - edited ‎05-21-2025 03:51 AM
Hello @Siva vittanala ,
That is not possible. The Primary Resource Skill field is a reference field and can only contain a single skill record.
If you want to link multiple skills to a person you have to load your data into the User Skills [sys_user_has_skill] table.
You can use this solution with a few adjustments. It's meant for the Group Roles, but you can simply change the table and field names as per your requirements.
Regards,
Robert