How to get persistence id from a java connector

Hello, 

I'm beginner at bonita and i'm trying to get the current persistence id of a launched process. 

In my process i create some user in the BDM at the beginning of the process and I want to get the persistenceid of that user  to call them in my  java connector.

 

Best

Hello,

When you create users, you need to do it in an 'Opperation'. Like:


User user = apiAccessor.getIdentityAPI().createUser("toto", "myPassword"")

 

This call, return an User object, so, the persistenceId is in the 'user' var.

Regards

Dear Dylan,

If you talk of users in BDM, I imagine that you have a bussiness object called "User" and in your process data, in the pool variables, you have defined a variable users that is a List of User, correct?

In that case, when you instance a process and initialize the list users, all data is stored in the variable. In each point of the process instance you can get the persistenceId of the User in that way:

import com.company.model.User
def userVar = new com.company.model.User();
def pid
userVar = users.get(i); // i is the index you want to know
pid = userVar.persistenceId; //here you have the persistenceId