If you have a checkbox in your form and want to present an answer in an email based on that checkbox, it will by default be presented as either on or off if you call it with a variable, ex. $form.field$ where "field" is the name of the checkbox.
In order to present something other than on or off, you need to set the value you want to present to another field and call that field in your email. To do this you need to use the "set field value" script component.
Here is a short description of how to set up your process and your form to do this:
1. Add a hidden field to your form. This will later contain the text that you will call and display in your email instead of the checkbox on or off value. Note that you do not need to set any value in the hidden field now, we will do this in the next step.
In this example, the label on the checkbox is "Click here to agree to the terms" but in our email we want to present it as a text that depending on whether or not the customer checked the box says:
Agreement received? Yes
Agreement received? No
2. Now, in your process model, before you send the email, you need to set up a gateway leading to two script tasks. The gateway will be configured so that it takes either the upper or lower path depending on what choice was made in the checkbox.
3. Configure the two script tasks by adding the Set field value script to them and associating the data object with the form as an output. Now, select the hidden field and "Set a custom value" to text you want.
In this example we want the hidden field to display as either Yes or No so in one script task we set the value to "No" and in the other we set it to "Yes". Don't forget to name the sequence flows from the gateway correspondingly.
4. Now, set the "No" sequence flow to default and double click the "Yes" sequence flow and press the set "Expression" button. In here, paste the following codestring and replace the "form" value with the dataID of your form and the "field" value with the name of your checkbox field. The script will find the value of the checkbox field in the form and if it is checked ("on") then the script will be true and the gateway will take this path instead of the default "No" path.
instance.GetDataObject(form)[field] == "on"
5. Finally, configure the intermediate send event email to look at the hidden field instead of the checkbox by entering the variable reference ($form.field) where you want to have the Yes or No value populated.
In this example, the form data ID and the field name used is reflected in the picture below. If you've chosen any other dataID and name for your form and field, simply replace the dataID and name in this example to match your own.
You can download the attached sample process, if you want to take a closer look at the configuration.