Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Exercise 3: Integration Hub (30mins)

During the discovery interviews with the Supplier Management team, it was often mentioned that they spend a significant amount of time checking the supplier’s business registration against the local business registries. This requires them to manually log into the business license portal and to pull out the license information and manually verify one by one. Fortunately, the business license registry offers an API to get information from each license number that we can use to make this process seamless, which we will use in Integration Hub.

In the lab, we will simulate calling a simulated API, which is modeled after an actual API provider: License Lookup. Check it out here: https://apis.licenselookup.org/business-license-search-api/

Adding a new field to our custom table

We first have to add a field to our custom Business License table to mark whether the record has been verified.

  1. Under All, search and navigate to App Engine Studio

  2. In the My recent apps section, click Supplier Management

  3. Under Data, click the Business License table

  4. In the Table Builder view, click + Add new field

  5. Under Column label, enter Registry verified (1)

  6. On the same row, under Type, change the value from String to True/False (2)

  7. Click Save on the top right of Table Builder (3)

Table builder comes standard in every Hyperautomation toolbox. Make sure you know how to use it effectively to construct the foundations of your applications.

Creating a custom action to connect via API

Now that we have the Registry verified field to indicate whether a record has been verified, we will use the Business License Search API to populate this field. We will first create a custom action to integrate with this API service, before using it in a flow.

  1. Navigate back to the main ServiceNow UI

  2. Under All, search and navigate to Flow Designer

  3. Flow Designer will open in a new browser tab

  4. On the top right of the screen, click New, then click Action

  5. Under Action name, enter Lookup license details

  6. Leave Application as Supplier Management

  7. Click Submit

  8. Click Create Input (1)

  9. In the new row that appears, change Label to License number (2), the name column will automatically populate with license_number

  10. Toggle Mandatory to true (3)

  11. Click Save on the top right (4)

  12. Click Add new step icon on the left side of the screen, in between Inputs and Error Evaluation

  13. In the pop-up, search rest, and select the REST step

  14. On the new REST step action screen, change Connection to Define Connection Inline (1)

  15. Under Base URL, enter https://my-json-server.typicode.com/shaoservicenow (2)

    Note: This is a mocked up API service that stores a database of license records

  16. Under Resource Path, enter /licenselookup/licenses/ (1)

  17. From the right Data panel, drag and drop the License number data pill onto the end of the string, after /licenselookup/licenses/ (2)

  18. Click Save

  19. Click Test

  20. In the pop-up modal, there should be one input field for License number as your defined in inputs. Enter the number 4828-19200-11024

  21. Click Run Test

  22. Once the processing is complete, click Your test has finished running. View the Action execution details.

  23. You should be directed to the Execution Details tab

  24. Scroll down and expand Steps

  25. Scroll down until you see Response Body, then click on the return value

  26. In the pop-up modal, select everything in the box and copy it to clipboard (Ctrl+c for PC or Cmd+c for Mac)

  27. Close this pop-up

  28. Return to the Lookup license details tab by clicking on it

  29. Close the Test action pop-up

  30. Click Add new step icon on the left side of the screen, in between REST step and Error Evaluation

  31. Search and click JSON Parser

  32. Drag and drop Response Body from the right sidebar onto Source data field (1)

  33. In the main section, paste the JSON object you copied from earlier (2)

  34. Click Generate Target (3)

  35. Click Save on the top right of the screen

  36. Click Outputs on the left of the screen (1)

  37. Click Create Output (2)

  38. Change the Label variable to Business name (1)

  39. Change the Name variable to business_name (2)

  40. Click Create Output

  41. For the new output, Label is Expiration date and Name is expiration_date, change Type to Date (1)

  42. Click Exit Edit Mode (2)

  43. Expand the root data pill under JSON Parser step on the right sidebar

  44. Drag and drop the business-name data pill onto the Business name field

  45. Do the same again with expiration-date onto Expiration date field

  46. Click Save

  47. Click Test

  48. Enter the license number 4828-19200-11024, then click Run Test

  49. Click Your test has finished running. View the Action execution details.

  50. In the Execution Details tab, do you see Business name and Expiration date populated under Output Data?

  51. Navigate back to the Lookup license details tab

  52. Close the Test Action pop-up

  53. Click Publish

Create a flow to use the API action

  1. Navigate back to App Engine Studio App Home

  2. Click Add under Logic and automation

  3. Click Flow

  4. On the next screen, click Build from scratch

  5. On the next screen form, under Name, enter Verify business license

  6. Under Description, enter Call the business license lookup API to verify a supplier business license

  7. Click Continue

  8. Once the flow has finished being created, click Edit this flow

  9. Close the Getting Started pop-up, if it appears

  10. Click Add a trigger

  11. We want this flow to be triggered when a record on our Business License table is updated. Choose Updated under the Record section

    Our trigger condition would be whenever Document Intelligence has processed a document as we saw in Exercise 2. This would be where the Business License Number has been extracted from the attachment.

  12. Search and select the Business License [x_snc_supplier_m_0_business_license] table under Table (1)

  13. Click Add filters under Condition (2)

    It’s important that this flow only runs when the Business License number has successfully been extracted from the license document by Document Intelligence. Add a condition to only run when the License number is not empty.

  14. In field selection, select License number (2)

  15. In operator, select is not empty (3)

  16. Click Done (4)

  17. Click Save on the top right (When working on a flow, save often!)

  18. Click Add an Action, Flow Logic, or Subflow

  19. Click Action

  20. Search lookup license details

  21. Click Lookup license details (this is the action we had just created)

  22. From the right data panel, expand Business License Record, then drag and drop License number onto the License number field

    We are passing the license number from our Business License record into the API to retrieve information

  23. Click Done

  24. On the right data panel, examine the 1 - Lookup license details data section. The two outputs, Business name and Expiration date were our outputs defined from the API call we created

    From these outputs we would like to validate back against the business license that the supplier submitted. This is meant to be illustrative, but you can continue to build additional verification logic if you choose.

  25. Click Add an Action, Flow Logic, or Subflow

  26. Cick Flow Logic, then click If

  27. Under Condition Label, enter Business name match

  28. Expand the Business License Record data pill, then drag and drop Business name data pill onto Condition 1 (1)

  29. The operator should be left default as is (2)

  30. From 1 - Business License Search, drag and drop the Business name data pill onto the next field

  31. Click Done

  32. Under the If branch, click Action

  33. Search update record

  34. Within the ServiceNow Core spoke, click Update Record

  35. Drag and drop the Business License Record data pill onto Record (1)

  36. Click Add field value

  37. Search and select Registry verified (2)

  38. Check the box next to the Registry verified field to mark as true (3)

  39. Click Test on the top right of the page

  40. In the pop-up, click and select record BSL001006

  41. Click the information icon

  42. Click Open Record

  43. The record will open in a new browser page (The business name should be Cyberdyne Systems) Keep the page open

  44. Back on the flow designer screen, click Run Test

  45. Switch back to the Cyberdyne Systems record page

  46. The Registry verified checkbox should change to true

  47. Switch back the the flow designer screen

  48. Close the pop-up, and on the top right of the form, click Activate

Great job on making it to this point. In this exercise, we used a custom integration through Integration Hub to verify the business license. So far, we have successfully managed to automate the retrieval, extraction and verification of supplier business licenses without any manual intervention! What used to be a very repetitive, boring task, which took Nintech Co. hours of work each week is now an automated process that takes less than 2 mins. The Supplier Management team now has more time to focus on work that requires human creativity and personality, like Supplier Relationship Management and working with Suppliers to help meet Nintech Co. and their shared ESG goals.

Previous exercise Next exercise


Back to top

Shao Wei Tan, 30 March 2023, based on the Utah release.