- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2022 04:27 AM
Hi All,
I am working on bulk importing 50 record producers into ServiceNow.
The only issue I have is the script. I need to add script for all record producers which I have.
The only thing that changes on the script for each Record Producer is the assignment group, as there will be specific group for each record producer.
I cannot use the sys id directly in the script and have to use gs.getproperty().
So I need help in creating a transform map script which looks at the group column in my sheet and for each record producer, it:
1. fetches the sys id of the group
2. Creates a system property with the group name and adds sys id to the value
3. Populates the script and adds the current.assignment_group = gs.getProperty(<sys id of property>);
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2022 11:26 PM
Oh I didn't know that field existed, great find.
In that case, you can just push the group into that field, and use the following in the script:
current.setValue('assignment_group' , cat_item.group);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 03:10 AM
Have you used a html field rather than a multi-line field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2022 05:05 AM
Hi,
For what i understood, you have an excel with column as "group" which stores the sys ids of the group. An need to store this as the property.
You can achieve this as the below logic.
//getting the sys id of the group from excel
var grpID = source.group; //column_name as per the excel
//Property Table
var gr = new GlideRecord('sys_properties');
if(gr.get('value',grpID)){ //checking if there is alredy any existing property
return;
}
else {
var counter = 1;
var propName = 'Group_Name';
var newName = propName + counter;
if(!(gr.get('name',grpID))){ //checking if there is any property with same name
createProperty(newName,grpID);
}
else {
//if there is property with same name then
counter++;
newName = propName + counter;
createProperty(newName,grpID);
}
}
function createProperty(newName,grpID){
//create new property
gr.name = newName;
gr.value = grpID;
gr.insert();
}
Mark this as Helpful in case this helps you in anyways.
Regards,
Sourabh