How to use the logged in user's id in our custom entity?

We are developing a work flow system in Java EE using camunda glassfish distribution.
It involves these following process:-

  1. User apply for advance
  2. Approver approve it
  3. User perform some adjustment activity for his previous advance application

Now our question is:

What is the recommended way to tag logged in user with our custom entity?
Should we embed userId with the custom entity? Or can we reuse any existing camunda service?

In short we want to retrieve the information of the logged in user applying for the advance then reuse it in our adjustment form fetching data from the advance process.

You should use the Modeler’s “Initiator” property on the start event which allows you to provide the name of a variable in which the user name of the user who started the process is stored.

In the Xml it then looks like this:

<startEvent camunda:initiator="my_var_name" ...>

In your JavaDelegate implementation you can then access the variable like this:

public void execute(DelegateExecution execution)
{
    execution.getVariable("my_var_name");
}

Does that help you?

Can you please elaborate? Where we will put the initiator property in our bpmn cause we didn’t find anything like that in our camunda modeler?

When we are trying to print the variable assigned to our initiator in our bpmn using the following command in our ejb:

LOGGER.log(Level.INFO, "variable " + delegateExecution.getVariable(“advanceApplicationUser”));

We are getting null.