jerryfiunam (61) [Avatar] Offline
#1
Hi smilie,

This time I need to store data that is provided by the end USER using FormKey's in StartEvent's and UserTask's. I have seen that exists basically two ways to do that:

1. Using "FormService" service with the methods:
For processInstances --> submitStartFormData(String processDefinitionId, String businessKey, Map<String,String> properties).
For userTask --> submitTaskFormData(String taskId, Map<String,String> properties)

2. Using "RuntimeService" service for process instances with this mkethod: startProcessInstanceById(String processDefinitionId, String businessKey, Map<String,Object> variables)

3. Using "TskService" service for userTasks with this method: complete(String taskId, Map<String,Object> variables)

My question is regarding about the differences or advantages and disadvantages using one over the other, for instance, what is the diference if I do this:

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

rather than this:

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

and viceversa.

In the same sence, the differences or advantages and disadvantages of doing this:

submitTaskFormData(String taskId, Map<String,String> properties)

rather than this:

complete(String taskId, Map<String,Object> variables).

I have tried boths options and I realized that using the formService, properties are stored always as String and the type is "FormProperty". On the other hand properties are stored according to the variable's type and type is "VariableUpdate".

I wonder if you can provide some information what is the difference between them or what are the considerations that have to be taken in count to decide when to use each one.

I hope you can clarify this smilie

Thanks in advance.

Jerry
tijs.rademakers (494) [Avatar] Offline
#2
Re: Storing USER DATA using FormService, TaskService and RuntimeService.
Hi Jerry,

The difference is that with the FormService method calls the form properties are considered and in the RuntimeService and TaskService they are not. So when you have define form properties and some properties as required you get an exception when they are not filled-in when you use the FormService method calls and you don't get an exception for the other methods.

Best regards,

Tijs