GlideLDAPGroups.setMembers() ignores "Run business rules" setting?

k0a1a
Kilo Expert

Can anyone from SNOW please confirm, that GlideLDAPGroups.setMembers() ignores the setting "Run business rules" of caller transformation map?

We import our SNOW users and groups from LDAP. For that purpose we employ out-of-the-box SNOW solution: stock onAfter transform script on group transformation, that contains the following code:

//

// After a group has been inserted the line of code below will get

// all the users that belong to the group according to LDAP and

// put the users into this group.   This is done by getting

// the value from the u_members field from the source record.

// If you do not want to put the users in the group then you

// can comment out or remove the line below.   If you are using

// something other than Active Directory and user membership is

// not indicated via the 'member' attribute then you can add the

// following line to indicate what field should be used.   This

// line would be added before the the call to addMembers.

//

ldapUtils.setMemberField('u_roleoccupant');

//

ldapUtils.addMembers(source, target);

ldapUtils is initialized in onStart transform script with an instance of LDAPUtils. The latter is located among stock Script Includes, and contains this relevant code snippet:

addMembers : function(source, target) {

    var ge = source.getElement(this.members);

    var geString = null;

      if (ge && !ge.isNil()) {

              this._log(ge.toString());

              geString =   ge.toString();

      }

    var group = new GlideLDAPGroups(target, geString);

    group.setMembers();

},

Now, GlideLDAPGroups.setMembers() inserts records in sys_user_grmember.

We have a business rule deployed on that table, which functions reliably on manual group membership manipulations in SNOW.

Despite flag "Run business rules" is set on our LDAP groups import transformation map, this business rule does not run when group membership records are created by this transformation map calling GlideLDAPGroups.setMembers()

I presume it's a "feature" of GlideLDAPGroups.setMembers()and I ask SNOW insiders for confirmation.

Thanks in advance.

1 ACCEPTED SOLUTION

johanhaglund
Giga Contributor

Hi Oleksiy,



I got an answer in a related case with ServiceNow. Apparently GlideLDAPGroups.setMembers() is NOT triggering any BR on table Group Member [sys_user_grmember] if there are NO roles associated on the group in question. So it will work if memberships to groups with roles are added but not without.



Cheers, Johan


View solution in original post

11 REPLIES 11

Hi Johan, thanks for sharing!


Is going to be the Correct Answer...


Great, thank you for sharing Johan.


johanhaglund can you help with this   Group Member Transform error


Well done for finding this out Johan, I was just about to think about coding this. I suppose I could use a 'child' role and just have them in my child groups in order to invoke the Business rule to propogate Users to their parent group.

 

Cheers

MGanon
Tera Guru

This issue is very popular. Thank you Johanhaglund for the resolution!