Setting process initiator on startevent

Good morning,

I have got a problem with setting the process initiator. I followed the example described here, but it does not work for me. Here ist my code:

 <bpmn:startEvent id="start_stammdaten_senden" name="Stammdaten absenden" camunda:formKey="app:stammdaten_eingeben.jsf" camunda:initiator="processStarter">
  ...

<bpmn:userTask id="task_send_email" name="Email editieren und abschicken" camunda:formKey="app:email_senden.jsf" camunda:assignee="${processStarter}">

but I get the exception:

ERROR [org.camunda.bpm.engine.context] (default task-6) ENGINE-16004 Exception while closing command context: Unknown property used in expression: ${processStarter}. Cause: Cannot resolve identifier 'processStarter': org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: ${processStarter}. Cause: Cannot resolve identifier 'processStarter'

I use Camunda 7.11

Thank you for your help,
Nicole

How are you starting the process - also could you upload your full model?

Hi @NickiMueller,

I see that you are using external forms “jsf”. which means the current authentication should be set before starting the process or otherwise the engine will not know the authenticated user who starts the process.

Have a look at below post

Good morning

I start my process via tasklist via “start process”
grafik

The startevent has a dedicated form “stammdaten_eingeben.jsf”. In <f:metadata> I configure the event listener preRenderView

    <f:event type="preRenderView" listener="#{camundaTaskForm.startProcessInstanceByKeyForm()}" />
  </f:metadata>

an at the end of the form I call

<p:commandButton id="submit_button" value="Antrag absenden" action="#{camundaTaskForm.completeProcessInstanceForm()}" />

For my understanding: I thought, the process definition key is generated from the engine, when I choose a process name from the “start process” link in tasklist and click start.
The process instance is generated when I call camundaTaskForm.completeProcessInstanceForm() by sending the form. Is that right?

So where is the point that I have to call a method which contarns the code you showed me?

  if (initiatorVariableName != null) {
String authenticatedUserId = Context.getCommandContext().getAuthenticatedUserId();
setVariable(initiatorVariableName, authenticatedUserId);
  }

Thank you for your help
Nicole

Hi @NickiMueller

This is the code I meant

identityService.setAuthentication(...);

Authentication should be handled by your application then passed to camunda using the above call. You can do that using servlet filter where you call the above setAuthentication() method “The filter should be mapped to the URL pattern of your jsf task forms”. That way the current authentication would be available in the current thread where jsf task form is running.

https://app.camunda.com/jira/browse/CAM-1117

1 Like

Hi @hassang,
is there an example application anywhere? Thanks a lot.
Nicole

Hi @hassang
I found my post from last year. Is there a way to add a servlet filter to the camunda tasklist? How can I add it? I know how to add it to my jsf application but not how to add it to the camunda tasklist.
If I would have an own login page I could read out the user. Then I could pass it to camunda (therefore I need your help: how can I pass it to camunda? How can I programmatically login to camunda tasklist?)

I want to avoid to implement an own tasklist.
Thank you again for your help
Nicole

Hi @NickiMueller,

External Task Forms means “the user is directed to another application to complete the task”
https://docs.camunda.org/manual/latest/user-guide/task-forms/

What I had pointed out in the above post is to define servlet filter in the JSF external application. And this solution would be a good option in case both tasklist and JSF external application are configured to run in Single Sign On mode.