cancel
Showing results for 
Search instead for 
Did you mean: 

How to set some required variables to start a process (besides the form)?

ssun
Champ on-the-rise
Champ on-the-rise
Hi everyone,

I was able to set required Activiti form variables on a process start event and this works great on the explorer. Human user has to enter the value of the variables on the form or they cannot start the task.
However, through the REST API, one can still simply start a process without providing these variables. Is it possible to make variables mandatory using the process definition? Or do I have to write my own REST service and validate the variables?

Thank you very much!

–Gordon
4 REPLIES 4

ssun
Champ on-the-rise
Champ on-the-rise
I'm thinking about a workaround which is have the very first task to be a script task and check the required variables and throw error/exceptions.
I wonder if there can be something easier built in.

trademak
Star Contributor
Star Contributor
When you use the form REST API you get exactly the same functionality as the Java API:

http://activiti.org/userguide/index.html#N15B82

Best regards,

ssun
Champ on-the-rise
Champ on-the-rise
Thank you trademak for the reply and the link. But it is not my question. I am looking for real validation to prevent a process instance from starting if required variables are not provided.
The form variables on the start event works if user uses the explorer but not when code using the REST API.

I hope this can be a feature on the REST API and fundamentally on the engine.

Thank you.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

You could add this functionality to org.activiti.engine.impl.bpmn.behavior.NoneStartEventActivityBehavior or to the listeners.

Regards
Martin