Default values for contracts

1
0
-1

I have a process that is automating a business decision based on the inputted data.
Now the form is dynamic, meaning some fields are shown cause of prior inputs like select box or a checkbox.
Because of this the json coming from the client can sometimes contain more fields and sometimes less.
But we all know that Bonita will give an Error if the contract is not met.
So what I want to know if there is a way to set the contract a default value, so that if that contract field is not present in the json than that field can be initialized with the default value.

1 answer

1
+1
-1

You have to change the FormOut javascript to populate the Contract prperly - you can add all your defaults here.

for example:

change formOutput to reference form new fields
original:

                return {
                        'customersInput': $data.formInput.customersInput
                };
        to:
                return {
                        'customersInput': {
                                'titre':$data.titre,
                                'firstName':"", //default here is null all the time (you'd never actually do this)
                                'lastName':$data.lastName
                        }
                };

regards
Seán

PS: As this reply answers your question, please mark as resolved.

Notifications