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

MGanon
Tera Guru

Incidentally, the sys_user_grmember business rules run as expected if associating users and groups in the UI. The role requirement only seems to affect background imports.

chunn
Tera Expert

@k0a1a    @JohnG3 

  I want to have a probelm Do you know 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.  I want to ask the all the users that belong to the group

according to LDAP but the userID is differenced how to do work. 

as pr.userID and pd.userId 

pr.userId is belong to prGroup

pd.userId is belong to pdGroup

Now the script is pr.userId is belong to prGroup and pdGroup and it is wrong.

 

ldapUtils.addMembers(source, target);