- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello All,
i have a excel sheet data with updatedgroupname and existinggroupname values.
i need to update the data existinggroupname is coelece so that it wont create updated fileds also i have created one on before script to do the name change.
The issue is group name is not updating.
@Ankur Bawiskar any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes it won't work to give security_admin via script.
Not a good practice to give security_admin via script even if it's feasible
security_admin role should be given only by Security admins and it should be a manual activity.
I believe I answered your original and subsequent questions.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes no field map
Everything (update or insert) will be handled via onBefore script
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Ankur Bawiskar ,
Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Ankur Bawiskar ,
Even if the record is there it created some also it created one empty record as well.
the script seems to be not ok can you please let me know what might be wrong in it?
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
are you sure the incoming name doesn't have any leading or trailing spaces due to which the query might fail
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if (source.u_name.nil()) {
ignore = true;
} else {
var gr = new GlideRecord("sys_user_group");
gr.addQuery("name", source.u_name.trim());
gr.query();
if (gr.next()) {
gr.name = source.u_entra_rbac;
gr.description = source.u_description;
gr.update();
} else {
// creation logic and role logic
var grr = new GlideRecord("sys_user_group");
grr.initialize();
grr.name = source.u_entra_rbac;
grr.description = source.u_description;
grr.insert();
}
ignore = true;
}
})(source, map, log, target);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You are correct @Ankur Bawiskar ,
The data contains space but i checked the excel sheet date some values contains space but the values which contain space those records also have space in in instance as well at last but still some duplicate entries are getting created the empty record creation stopped using the above script though

