Add users to the list in DL members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 06:50 PM
Hi All,
Having a requirement,
we have a DL table where we have a members and the owners fields both are list type fields in it and the data is getting into this table is via ldap sysnc.
while sync in the ldap transform map we have a script mapping to the field. In that we are trying to use the below script but it only picking the one value of the user and adding into the members list. if the members are multiple its not updating all the members list in the table.
Any suggestions on this, below is the script that we are using in the script mapping.
*********
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2024 10:24 PM
Hi @Community Alums ,
You need modify the script little bit
Hoping the source.u_member has comma separated value
answer = (function transformEntry(source) {
if (source.u_member != '') {
var vSource = 'ldap:' + source.u_member.split(',');
for (var i = 0; i < vSource.length; i++) {
var ldapMember=[];
var vUser = new GlideRecord("sys_user");
vUser.addEncodedQuery("company=d098f022db06b300e0d1b9836b961982^sys_domain=28c7f0aedbc2b300e0d1b9836b9619ab^active=true^source="+vSource[i]);
vUser.query();
if (vUser.next()) {
ldapMember.push(vUser.getValue('sys_id'));
} else
return ""; // return the value to be put into the target field
}
return ldapMember.join(',');
}
})(source);
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thanks,
BK