Validation -required


Hello Everyone


i have two attributes in the one user task the First one like (enum) approve or Rejected. the second attributes is Reason like string.

How can i convert Reason like validation -required when i selected Rejected from Camunda BPM modeler

Suhaib Sultan


Hi Suhaib,
as far as I know I think you can not do the “conditional validation” with the generated task forms.
I suggest that you should create your own task form (embedded task form), where you can easily do this.
See this for more information about the forms.
Hope that helps.


i think i need to mention that in java code but i do not know how can i mention if i selected Rejected it should be required.

this Java Code::

public class AccountNumberFormFieldValidator implements FormFieldValidator {

private static final String PATTERN = "[0-9]+";

public boolean validate(Object submittedValue, FormFieldValidatorContext validatorContext) {

	Map<String, Object> formValues = validatorContext.getSubmittedValues();
	System.out.println(" formValues" + formValues);
	if (submittedValue instanceof String) {
		String string = (String) submittedValue;

		return string.matches(PATTERN);

	return false;



Oh, I am sorry I thought we are talking about doing this whole thing in modeler or generated task forms.
Unfortunately, I do not know how to do this in java.