Use Transform map to add user name target group member User?

Navneet3
Tera Expert

Hi

I created a transform map to add users to a group but for some reason the transform is creating the users too.

What am I doing wrong?

Please see the attachments.

 

Thank you

3 REPLIES 3

Najmuddin Mohd
Mega Sage

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.

Hi

The solution did not work.

Is there another solution?

thank you

Hi @Navneet3 
Can you share the sample record of the excel and the screenshot of the scripts written.

Regards,
Najmuddin.