Populate combo box from Web Service
Blog: Flokzu
When completing a task, users will sometimes have to fill in a field by choosing an option from a combo box. A typical example is a list of countries, cities, products, etc. If that list is too long, setting up the combo box manually would take too much time. In those cases it’s very useful to populate a combo box from a Web Service. Plus you can use it to import data from one of your own systems.
How to set it up
When setting up your process, in the ‘Process Form’ tab add a new field. Select ‘Combo box’ as field data type and choose the option ‘Populate from external Web Service’. Then click ‘Set up your Web Service here…’
A window will pop up, where you can set up your Web Service:
- On the Web Service URL (REST) field, type the public URL of your Web Service.
- (Optional) In case you need to pass parameters to your Web Service, you can define them in the Input tab. You’ll have to specify a name and a value for each parameter added. The value can be selected from one of your fields or typed in manually.
- On the Output tab, map the Web Service response (that should be a JSON string) with the label and value of the options that will populate the combo box. Both fields are required, but you can choose the same label and value if you want.
In most cases, the system will display only the label. The main goal of distinguishing between value and label is to use the value as an input parameter in another Web Service call (in which case you’ll have to use the value instead of the label). The typical example would be to use a country value to populate a combo box with the cities of that country.
4. On the Web Service Settings pop up, click Accept.
5. On the Field Settings pop over, click Accept.
Please consider that the expected response format of your Web Service is as follows: [ { “country” : “Afghanistan”, “id” : “AF” } , { “country” : “Albania”, “id” : “AL” } ]
The combo box options will be calculated when opening the Document (as long as the field’s visibility is editable or required) and when any of the parameter field changes. As an input parameter you can select a field which will be hidden in that task. In that case, the value of the input parameter is the one the field had in the previous task.
Note: the REST Web Service call will send a HTTP get request.
The post Populate combo box from Web Service appeared first on Flokzu.
Leave a Comment
You must be logged in to post a comment.