cancel
Showing results for 
Search instead for 
Did you mean: 

Can not pass process variable if using submitStartFormData to new process

dean
Champ in-the-making
Champ in-the-making

the API of 

formService.submitStartFormData

only support Map<String,String>, but If I have a service task after the start form event, which need accept a boolean value or complex java bean. How can I pass process variable just like 

runtimeService

startProcessInstanceById(String processDefinitionId, String businessKey, Map<String,Object> variables)

 

 

Same problem but not solved

1 ACCEPTED ANSWER

gdharley
Elite Collaborator
Elite Collaborator

Ok, Just because you use a start event (all processes MUST use some kind of start event), doesn't mean you have to start the process using a form.

There are many ways to start a process, if you want to inject variables other than Strings then you need to use the appropriate runtimeService.startProcessInstanceByID() or startProcessInstanceByKey().

Thanks,

Greg

View answer in original post

6 REPLIES 6

nikmenke
Confirmed Champ
Confirmed Champ

Hi,

why don't you use the startProcessInstanceById method? You could also pass your form variables there.

gdharley
Elite Collaborator
Elite Collaborator

Why do you "have to" use toe formService rather than the runtimeService?

Runtime Service lets you start a process instance with business key, variables etc.

If formService is a requirement, please explain the scenario so we can help.

Greg

dean
Champ in-the-making
Champ in-the-making

Hi Greg,

Because I used start form event, when user submit a form request then start a new process instance. I think that is why formService provides the function 'submitStartFormData'. 

My start event:

<startEvent id="start" name="Start" activiti:initiator="applyUserId">
  <extensionElements>
    <activiti:formProperty id="f_name" value="${f_name}" name="Name" type="string" expression="#{contact.name}" required="true"/>
  </extensionElements>
</startEvent>

I need pass complex java bean 'contact' into process as process variables. Then use formService.submitStartFormData to start the process, the form variable should be a map, key is 'f_name', value is 'jeff'.

After the process instance started, I could get contact from process, the contact.name should equal 'jeff'.

gdharley
Elite Collaborator
Elite Collaborator

Ok, Just because you use a start event (all processes MUST use some kind of start event), doesn't mean you have to start the process using a form.

There are many ways to start a process, if you want to inject variables other than Strings then you need to use the appropriate runtimeService.startProcessInstanceByID() or startProcessInstanceByKey().

Thanks,

Greg