In Progress

CHelper.setAttrib not updating idBossUser in WFUSER table

Hi,

I am importing active directory users into Bizagi using LDAP synchronisation - which is working as expected. However as the LDAP synchronisation does not allow for foreign key look-ups when importing data, so I have created a manually scheduled job with a scripting expression to manually look up and set the IdBossUser (based on the 'manager' LDAP attribute) for each record in the WFUSER entity.

The problem is that the CHelper.setAttrib function will not update the idBossUser attribute in the WFUSER table.

See below the scripting expression I am using and the resulting trace file (attached). The fact that the trace file generates a line for all records in the entity tells me that the task is being executed correctly, it is simply first the 'CHelper.setAttrib...' line of code that is not working as expected.

Note that the second 'CHelper.setAttrib' line which updates the 'contactEmail' attribute works correctly.

Please advise as to how I should go about updating the idBossUser field with a scripting expression.

var OUsers = CEntityManager.GetEntity("WFUSER").GetEntityList("", "", "", "");

for(var I=0;I<OUsers.Length;I++){var UserId = OUsers[I].SurrogateKeyValue;var Manager = OUsers[I].Attributes["Manager"].Value;var BossUserId = CHelper.getEntityAttrib("WFUSER","idUser","DistinguishedName = '"+Manager+"'");if (BossUserId != undefined){CHelper.setAttrib("WFUSER",OUsers[I].SurrogateKeyValue,"idBossUser",BossUserId);CHelper.setAttrib("WFUSER",OUsers[I].SurrogateKeyValue,"contactEmail","bizagi@coro.com");CHelper.trace("UpdateBossUser", "ROW = "+I+"; UserId = "+OUsers[I].SurrogateKeyValue+"; BossUserId = "+BossUserId);}}

Thanks,

Iain

photo
0

Dear Lain,

Meanwhile we try to reproduce what you said, LDAP synchronization has the possibility to import users mapping some attributes according to your needs.

Move on to the next tab called Attribute mappings and make sure you add the necessary mappings for your WFUser attributes. To do this, first click on the Add Mapping button.Select attributes from the WFUser Entity and match them to an LDAP attribute, which has the incoming information: ldap02 Note that in this example we illustrate mapping the mail and name attributes (recommended).

To see some LDAP attributes, please go to: http://help.bizagi.com/bpmsuite/en/index.html?ldap_attributes.htm

regards

photo
0

Hi Juan,

I am already mapping the LDAP 'manager' attribute to a custom user field (see attached).

But Bizagi uses a foreign key for the boss user reference so I cannot map the LDAP manager field directly to idBossUser, I first have to look up the correct idBossUser using the scripting expression in the original post.

Example:

User --> Bob Thomas

  • idUser --> 167
  • fullName --> Bob Thomas
  • LDAP manager --> "CN=Tom Jones,OU=Investment - Dealing and Implementation,OU=Coro,OU=Users,OU=CapeTown,DC=coro,DC=com"
  • LDAP distinguishedName --> "CN=Bob Thomas,OU=Investment - Dealing and Implementation,OU=Coro,OU=Users,OU=CapeTown,DC=coro,DC=com"

User --> Tom Jones

  • idUser --> 46
  • fullName --> Tom Jones
  • LDAP manager --> "CN=Joe van Niekerk,OU=Investment - Dealing and Implementation,OU=Coro,OU=Users,OU=CapeTown,DC=coro,DC=com"
  • LDAP distinguishedName --> "CN=Tom Jones,OU=Investment - Dealing and Implementation,OU=Coro,OU=Users,OU=CapeTown,DC=coro,DC=com"

Therefore for each record in the WFUSER entity, I have to look up the corresponding boss user where WFUSER.manager = BossUser.distinguishedName, and then update the WFUSER.idBossUser with the surrogatekey of BossUser.

I do not think this can all be done directly in the LDAP sync, it has to be done by a scripting expression scheduled to run after this.

photo
0

Dear Lain,

Thank you for your feedback. Another possible idea to solve it is using SOA Layer. You can invoke saveEntityAsString method.

For further information: http://help.bizagi.com/bpmsuite/en/index.html?saveentityasstring.htm

Please check the attached file.

Regards