Example

In this example we will use the API of the New Zealand Ministry of Business, Innovation & Employment (MBIE) to provide AutoComplete functionality for a New Zealand Business Number field.

The New Zealand Business Number field appears on a detail page that has been defined for a project application type. See this link for information about the API that we are using:

https://api.business.govt.nz/api/apis/info?name=NZBN&version=v3&provider=mbiecreator

This API requires authentication, so you must obtain a bearer token from MBIE. See this link for instructions:

https://support.api.business.govt.nz/customer/portal/articles/2534350-oauth2-authentication

Adding the application detail

For this example we'll use a project application type called ACTest (AutoComplete test). Add an application detail and create a new detail page. Add a new table with the family name Proj and the common ID ProjDtl. The family name and the common ID will be used to construct the moniker of your component.

Then, in the Data Builder grid, add the New Zealand Business Number field. Select the Show Advanced check box and specify mbienzbn in the Common ID column. This common ID will later be used to identify the property. Set the data type to Long.

You can now save your detail page. Infor Public Sector creates the detail and the agency table/business object, which you can look up in the Schema Manager. You are then taken back to the Application Details dialog box. Select the Shown in Start Application check box and click Save.

See the Infor Public Sector Project Administration Guide for more information about application details.

Adding the service profile

Open the Create Service Profile form (System > Service > Create Service Profile) and add a new service profile called MBIENZBN. Set the format to Json and the request method to Get.

The host address for the service profile is shown below. Note the search term in the query string. This is set to the common ID of the property for which you are configuring AutoComplete.

https://sandbox.api.business.govt.nz/services/v3/nzbn/entities?search-term={{mbienzbn}}

We will add a header to the Headers grid to pass in the bearer token for authentication. Specify Authorization in the Name column and enter your bearer token in the Value column.

Finally, add a response mapping to the Response Mapping grid. Set the source to items[*].nzbn and the destination to [1].mbienzbn.

AutoComplete configuration

The final step is to add a new component to the AutoComplete configuration. Add a child COMPONENT node to the COMPONENTS node and add these attributes:

Attribute Value
Index Manager Type Hansen.Core.IndexSearch.NetServiceIndexManager
Index Search Type Hansen.Core.IndexSearch.NetServiceIndexSearcher
Component Moniker InforClient.Proj.ProjDtl
Property mbienzbn
Service Profile Name MBIENZBN

Testing

To test, open the Start Application form from the Project menu in Infor Public Sector. Specify ACTest in the Application Type field, then select the Details tab and begin typing a number in the New Zealand Business Number field. Your AutoComplete results are displayed after you type the minimum number of characters specified in the AutoComplete configuration.