Use Transform map to add user name target group member User?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 09:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 10:44 AM - edited 08-09-2024 10:47 AM
Hi @Navneet3
I would have done the requirement in the following way,
Target table : Group member [sys_user_grmember]
Field Mapping:
1. Group: For group, create a field mapping and checkbox the Use source script and return the 'sys_id' of the group. Hardcode it.
2. User: For user, create a field mapping and checkbox the Use source script and return the 'sys_id' of the user with the following script.
GlideRecord the user table with the name and return the 'sys_id' with the following script.
var userSysId = new GlideRecord('sys_user');
userSysId.addQuery('name',source.name of the row in the excel that defines the name of the user);
userSysId.query();
if(userSysId.next()){
return userSysId.sys_id;
}
The reason for the going with the sys_id is that these are reference fields and we are just we are creating group member records with the existing sys_ids.
If you feel that you may have multiple users with same names in the User table, then add one more query with the email filter to get the accurate user.
Mark as helpful, if this information helps you.😊
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 12:17 PM
Hi
The solution did not work.
Is there another solution?
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 12:24 PM
Hi @Navneet3
Can you share the sample record of the excel and the screenshot of the scripts written.
Regards,
Najmuddin.