I need to get the personal email from a user, I can access to this info through the api on UI Designer but I can't on groovy, what's the method to access it?
I have tried identityApi.getUserContactData but it only shows the contact email and I have tried identityApi.getUser but it doesn't appear an Email method for me
Hi rogoca,
On a groovy script you would be using the Java APIs: https://documentation.bonitasoft.com/bonita/latest/api/engine-api-overview
In order to make it simpler, when you open the script editor on Bonita Studio, on the left you can double-click on "Code Templates" > "Bonita Users" > "userPersonalContact". This will result in adding the following code to your script which will allow you to access your user data based on the userId:
def personalContactData = apiAccessor.getIdentityAPI().getUserContactData(userId, true)
It is the equivalent of this call done by the UIDesigner: https://api-documentation.bonitasoft.com/latest/#tag/ProfessionalContactData/operation/getPersonalContactDataById
Hope this helps!
-Thalía
hello,
thanks for the answer, I tested this but this gives me business card information, not personal information, on the bonita administration application I have business card and personal information, this solution gives me the business card data and not personal information, how do I access this?
You can say if you need the personal or professional data with the second argument which is a boolean, like this:
def personalContactData = apiAccessor.getIdentityAPI().getUserContactData(userId, true)
def professionalContactData = apiAccessor.getIdentityAPI().getUserContactData(userId, false)