how to update Custom user information by script

Hi All,

How can I update the value of custom user information by Script task !?

It is possible !?

Pls, help me the right way to do this,

Thanks,

Hi,

You can use the identityAPI like this:

import org.bonitasoft.engine.identity.ContactDataUpdater import org.bonitasoft.engine.identity.UserUpdater

def contactDataUpdater = new ContactDataUpdater()
contactDataUpdater.email = ‘updated@email.com’
// Update additional fields if required…

apiAccessor.identityAPI.updateUser(userId, new UserUpdater().setPersonalContactData(contactDataUpdater))

//For custom user info

def customInfoDef = apiAccessor.identityAPI.getCustomUserInfoDefinitions(0, 100).find{ it.name == ‘myCustomDefinitionName’}
apiAccessor.identityAPI.setCustomUserInfoValue(customInfoDef.id, userId, “new value”)

HTH
Romain

Dear Romain,

Many thanks for your support, I will try it and feed back if have any question :D

Once again thank you so much !!!!