AnsweredAssumed Answered

Validation - Form Properties

Question asked by sam_a on Jul 5, 2017
Latest reply on Jul 7, 2017 by ryandawson

I have a requirement to have strict validation of form properties (i.e) activiti should only save the exact form properties that are defined as part of extension elements under a user task. 


Assume I have a userTask with some form properties attached.

<userTask id="usertask1" name="Submit Form">
        <activiti:formProperty id="name" name="Name" type="string" variable="name" required="true"></activiti:formProperty>
        <activiti:formProperty id="age" name="Age" type="string" variable="age" required="true"></activiti:formProperty>   


On POST, I build the variables from the request and invoke the below line of code to save the values and complete the task.


formService.submitTaskFormData(taskId, variables);


If I don't pass any of the defined properties, the system spits out an exception stating "form property ..... is required". This is good. My issue is if I pass in any additional value as a form property like 'address', activiti accepts it and saves it.


Is it possible for me to tell activiti to accept only the two properties that are defined and throw an exception if any additional properties are sent in? If there is no straightforward solution to it, what is best way for me handle/validate this?