Can not pass process variable if using submitStartFormData to new process

cancel
Showing results for 
Search instead for 
Did you mean: 
dean
Member II

Can not pass process variable if using submitStartFormData to new process

Jump to solution

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 Solution

Accepted Solutions
gdharley
Intermediate

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

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 solution in original post

6 Replies
nikmenke
Active Member II

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

Hi,

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

gdharley
Intermediate

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

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
Member II

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

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
Intermediate

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

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

dean
Member II

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

Hi Greg,

Thanks for the quick reply

I still think believe the interface should add one more parameter

from 

ProcessInstance submitStartFormData(String processDefinitionId, String businessKey, Map<String, String> properties);

to 

ProcessInstance submitStartFormData(String processDefinitionId, String businessKey, Map<String, String> properties, Map<String, Object>
variables
);
gdharley
Intermediate

Re: Can not pass process variable if using submitStartFormData to new process

Jump to solution

Feel free to open an Jira and even better, provide a pull request with the implementation you are looking for.

Can't guarantee the feature will get into the code, but a pull request is you best opportunity.

Greg