Article last updated on the 2nd of September, 2022.
Note that the steps included in the configuration described in this article includes using data binding to look up data outside of WorkPoint, which is a ★ Premium feature.
This article is a continuation of a previous article in which an example Http endpoint was configured.
In the following example, we will show how the previously configured Http endpoint can be used in a WorkPoint process.
As a reminder, the Http endpoint configured in the previous example returns data of Danish companies provided a company name.
In the following example, we will configure the "Entity Form" step of a process to accept input from the configured Http endpoint. We will be able to search for a company using it's name, and use the search result to fill in the Title and CVR number fields in the Entity Form.
for the purpose of this example, we have set up the following WorkPoint process:
- To edit the Entity Form step, we simply click it. This opens the settings panel for the step:
- Since we want to edit settings for a field in the Entity Form, we open the "Fields" tab.
- Next, we select and expand the field which we want to fill out using the Http endpoint we have configured. In this case, we want the CVR Number field to be filled with the CVR number from the company we search for.
- In the options for the CVR Number field, under "Data source" we click the "Data source" button.
This opens the "Data binding" panel on which we can configure the data source for the VAT number field:
- First, we provide the Data binding with a title. In this example, we provide the same name as the Http endpoint title.
- For "Type" we select "Endpoint" and in "Endpoint" we select the Http endpoint we configured earlier. In this example, it was called "SearchCompanies".
- The "Parameters" section of the panel will display the parameters we added in the Http endpoint configuration. In this example, we have two parameters; one called "cvr_number" and one called "name". We can expand each of the parameters to reveal more options:
- In the "Title" field, we can give the search field for the parameter a title. This will be displayed if the parameter is shown using the "Pinned" or the "Additional" Display type, as exemplified using the "Name" parameter in the following image:
Note that if the type of the parameter is set to "Default", the title will not be shown.
- In the "Description" field, we can type in a help text, which will be displayed inside the search field until a user types something into the field. As was the case for the "Title", this is only applicable for parameters with the "Pinned" or "Additional" Display setting. This is exemplified using the "Name" field in the following image:
- In the "Type" field, we can define how we want the field to be displayed and how it should behave. The choices are:
- Text: A simple text field is displayed in which users can type in a search query.
- DateTime: A calendar is displayed when the field is focused in which the user can pick a date.
- Boolean: A toggle control is displayed in which the user can select either Yes or No (true or false).
- Choice: If selected, the parameter is shown as a drop down with choices according to the additional "Choices" field.
- MultiChoice: If selected, the parameter is shown as a drop down with choices according to the additional "Choices" field. Multiple selections can be made.
- In the "Display" field, we can select the display type of the parameter. Choices are:
- Default: If selected, the parameter will be the default parameter, and the search query can be passed into the field itself in the form, or in the default search box in the top of the search panel. Note that you can have multiple parameters set as "Default" display type, in which case, either search query can be made in the field or the default search box.
- Pinned: If selected, the parameter will be displayed just below the default search box in the search panel. Parameters set as "Pinned" will always be displayed and cannot be hidden.
- Additional: If selected, the parameter will be displayed inside an expandable and collapsible "Additional filters" group. Parameters set as "Additional" can thereby the displayed or hidden by expanding or collapsing the "Additional filters" group.
- In the "Value" field, we can provide a default value for the parameter.
In this instance, we have configured the two parameters as follows:
Next, we need to configure which of the returned properties to fill the selected field with (in this case, the CVR number field):
- Next to the "Value Property" field we click the property selector button.
The "Filter" field can be used to filter the returned results from the endpoint. In the case of our example, we could e.g. filter the companies returned from the endpoint so that we only get to select from companies with more than 200 employees (given that the endpoint returns such a statistic).
The "Path" field can be used to specify from where the selectable properties in the "Value property", "Title property" and "Description property" fields should begin. The endpoint we are using in this example returns an array with one object, the company object, along with a lot of data. If it instead e.g, returned a big object, but we only were interested in data inside a single sub-object, we could select that object in the "Path" field. In the "Value property", "Title property" and "Description property" fields, we would then only be able to select from that object downwards.
- In the property selector, we select which property returned by the API to fill the CVR number field with. In this example, we select the "cvrNummer" property.
The selected property should now appear in the "Value Property" field:
Next, we will add the "cvrNummer" property to the "Title property" field and the "virksomhedMetadata.nyesteNavn.navn" property to the "Description Property" field:
For this example, we will also enable "Typeahead":
- To enable Typeahead, simple enable the checker. Typeahead makes it possible for the system to start searching when the user has input a small set of characters instead of having to wait for a full query and the push of a search button.
At this point, we can save and publish the process and start using it to create companies using data from our endpoint.
Before we do this, however, we will configure the system to automatically fill in the Title field in our form with the newest name of the selected company from our endpoint.
First, we close the Data binding panel for the CVR Number field:
- In the Data binding panel for the CVR Number field, click the "Close" button.
- Next, we expand the options for the "Title" field.
- for the "Value" field, we click the "Advanced" button.
- In this instance, we want to use an expression to tell the system to take information from the data binding of the CVR Number field and fill the Title with some data from the endpoint response. In the configuration panel for the Title field, under "View" we click "Advanced".
- In the "Expression" section, we type in the expression which lets the system know to fill the Title field with data from the CVR Number data binding. The "getValue" method helps us get a value from another field. We need to provide the getValue method with a field which has a data binding set up to get a response from a Http endpoint. In this case, the CVR Number field from the EntityForm is set up to be filled in using a response from a Http endpoint, and the response also includes the most recent name of the company we look up. We therefore provide "EntityForm.wpCVR" as the first parameter of the getValue method. Note that for the first parameter, you must use the internal field name of the field, hence the "wpCVR", which is the internal name of the CVR Number field. For the second parameter of the getValue method, we need to provide the property name of the Http endpoint response which value we want to fill the Title field with. In this case, we want the Title field to be filled with the most recent name of the company which is provided by the Http endpoint response. That property in the response is called "virksomhedMetadata.nyesteNavn.navn", so we type that in as the second parameter. The full expression is then the following:
- We can now close the configuration panel for the Title field.
We can now also save and publish the process:
- We click "Save as draft".
- We can then click the "Publish" or "Republish" button to publish our changes.
3. End User Guide
Visit this article for a guide on how to use WorkPoint processes which uses Http endpoints.