The following guide will introduce some of the details you need to take into consideration when interacting with yes/no lists via the RPM API.
Process Template
When setting up a yes/no list field, you can configure it in different ways:
- Value column labels determines the text to display for the yes and no answers
- Value column order determines which answer shows up first
- Value column format determines if the yes/no list should use check boxes instead of radio buttons
- Text value position determines if the option text shows before or between the yes and no answers
- Null column allows to enable and determine the display text for a “not applicable” answer
- Comments column allows to enable and determine the display text for a “comments” free-text answer
This guide will show a process template with a yes/no field setup with the options shown in the previous image.
Displaying a yes/no list field
When displaying an entire form, any of the fields could be a yes/no list. This section shows how to retrieve the data and how to interpret the data related to a yes/no list field.
The ProcFields API endpoint returns the setup information for a process. The following is an example based on a process setup with only one yes/no list field (as seen on the previous screenshot).
Sending the ProcFields request
Sending the request to the API:
The response will look something like this:
The ProcFields response
Looking at the “Fields” list in the response, notice that there’s only one field Named “Yes/No List field” whose “FormatType” is 47 (YesNoList). One attribute we are interested in is the “InternalFormat”:
Looking at the parsed Internal format you can see the same properties that we setup at the beginning but presented in a JSON format:
- Value column labels “LabelYes” and “LabelNo”
- Value column order “OrderSwap” (true means Yes/No, false No/Yes)
- Value column format “RenderCheckbox”
- Text value position “TextMiddle”
- Null column “LabelNull” and “HideNull”
- Comments column “LabelComment” and “ShowComment”
The options to display in the list are available via the “Options” list.
Retrieving form data
The ProcForm API endpoint, provides the data stored in one form.
Sending the ProcForm request
The response will look something like this:
The ProcForm response
Looking at the “Fields” list in the response, the “Value” of the “Yes/No List field” will be a string-encoded JSON that contains the value for each option where the user chose something other than the Null option, after decoding the data it looks like this:
Each option contains a “Value” key that indicates which value was chosen:
- 1 means the user chose the “No” option
- 2 means the user chose the “Yes” option
Use the “OptionID” key to match with the option text available via the ProcFields API call.
This is the basic information necessary to display a yes/no list field. Inside RPM they are displayed in the following way:
Notice that options that have the “N/A” option selected (in this example “Maybe”) are not shown on the view.
And that is the basics of how to interpret and handle the data received via the API:
- Use ProcFields to get the setup information on how to display a yes/no list fields
- Use ProcForm to get the actual data in the field when displaying a form
Other yes/no list configurations
Checkboxes
When the a yes/no list is setup to use checkboxes the Null option must be ignored as it’s not possible for the user to respond “not applicable”.
Note how the “Null column” section on the setup page has disappeared. In the response for ProcFields: