Contract variables need to be fulfilled even if not mandatory?
Hi everybody,
I created a simple form with a text area to allow users inserting a comment. In human task, I defined a text variable called "note", in the form I created a variable called "note" of type String and a javascript variable outputForm as follows:
return {
"note": $data.note
}
formOutput is in the field "Data sent on click" of a button in the form. Even if the text area is NOT mandatory, when I try to submit the form with EMPTY text area, I get always the error saying the contract is not fulfilled (clearly as note variable is null).
Can anyone help me?
How is it possible to define a NOT MANDATORY text area without having contract troubles?
Thank you
I think this is not the correct answer (for my purpose).
I'll make an example: I got a process with 3 steps, in each of them the user can write a comment to explain what he/she did in his/her step. The comment (entity) is a BDM object, linked to the main BDM object (entity) of the process (may be a purchase, an order, a decision iter, and so on). If I do what you say, I will put a lot of empty string in my database, and it's surely not correct.
Do you agree with me?
Comments
But you didn't make that clear in your original post however...
Based on what you've got, a BDM within a BDM, then this is perfectly acceptable.
Just don't add the empty note to the main BDM object.
I would write something like this as my Output Operation:
mainBDM.setNote(noteBDM) //only set the field if not null
}
This way you end up with an empty field in the BDM rather than empty string in the BDM.
I assume you've done it this way because you can have multiple notes per main BDM... :)
Sometimes it is a neessary to have blank fields...which is what an empty field is after all..
regards
The problem with a contract is that a contract is between the form and the process, it is not between the BDM and the process.
I understand the problem you're having, but that's the way Bonitasoft designed it...
regards
Comments
Leo has it exactly right...
regards
Seán