Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

LDAP import is not updating group membership

Mark251
Mega Guru

I create an LDAP import and a transform map for LDAP groups. I have included the following scripts in the transform map
OnStart: gs.include("LDAPUtils");
var ldapUtils = new LDAPUtils();
ldapUtils.setLog(log);
OnAfter: ldapUtils.addMembers(source, target);
I have also validated that the source field in the sys_user table is 255 characters

When I do the transformation the groups are created successfully however the group members fail with the following error
Error during insert of sys_user_group (group name here)
There is nothing on the logs

I have 2 separate LDAP OU definitions and I plan to configure many more
Groups-ServiceNow Test
Groups-OKTA
These each have their own transform maps and datasources (as I could not figure out how to use just the one).
The OU definition "Groups-ServiceNowTest" works and imports all the group members but the other one does not. When I add members manually, the import and refresh removes the members.

Ideally I would just like to add multiple OU's in the one configuration but this is the only way I could do it.

1 ACCEPTED SOLUTION

Mark251
Mega Guru

I actually figured it out myself using an onBefore script so I would not need separate loads and transform maps. I did this on the core RDN and just filtered the OU's that I wanted.

//Test if the entry contains the name ServiceNow Automation
ignore = true;
if(source.u_distinguishedname.indexOf('ServiceNow Automation') > -1){
ignore=false;
}
else if(source.u_distinguishedname.indexOf('ServiceNowTest') > -1){
ignore=false;
}

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi Mark,

You can refer to this thread, this will help you:

https://community.servicenow.com/community?id=community_question&sys_id=f4beb2a5db58dbc01dcaf3231f96...

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Mark251
Mega Guru

I actually figured it out myself using an onBefore script so I would not need separate loads and transform maps. I did this on the core RDN and just filtered the OU's that I wanted.

//Test if the entry contains the name ServiceNow Automation
ignore = true;
if(source.u_distinguishedname.indexOf('ServiceNow Automation') > -1){
ignore=false;
}
else if(source.u_distinguishedname.indexOf('ServiceNowTest') > -1){
ignore=false;
}