This blog is part of the series Visual Builder Cloud Service Learning Path. In a previous lesson, we designed the process we will use in our application. If you don't have it, you can download the process and the VBCS application and import them into your environments. We assume that you've named the process Expense Approvals and have already started the process in Test mode as described in the first chapter.

In this chapter, we will configure the process to update the status field on the expense request record after each task. We will do this by calling into the VBCS business object REST interface. This task has the following steps:

  • Configure a REST connection to VBCS business object. Because the endpoint for the business object changes depending on the VBCS app's version and mode (i.e. development, test, live), we need to pass in the mode and version as parameters with our start message.
  • Configure a system action to call the business object REST endpoint.

Defining the Service Connection

  1. In the PCS Process Editor, open the Expense Approvals application.
  2. In the left sidebar, click Integrations.
  3. Click Create > External > REST
  4. Name the REST connection ExpenseREST and set the base URL to https://yourBaseURL – basically everything before /ic/builder/etc.
  5. Under Resources, click Add.
  6. Name the resource ExpenseReport and set the path to ic/builder
  7. Click the Add button to add a PATCH operation.
  8. In the Path field, enter {mode}/Expense_Reports/{version}/resources/data/ExpenseReport/{id}. Notice that the app automatically creates the input parameters for you. You can find the URL for the business object REST APIs in the overview page of the business object editors.
  9. Click the + button next to Body. Set the Name to ExpenseReportUpdate and enter {"status":"Draft"} into the body. (We are only passing the status field so there's no need to define the rest of the valid PATCH payload.) Click Next then Import.
  10. Click the Response tab. Click the + button next to Body. Set the Name to ExpenseReportUpdateResponse and enter {} into the body. (We aren't going to use the response in the process so there's no need to correctly define the response payload.) Click Next then Finish. 
  11. Click Apply button for the Resource.
  12. Click Edit next to Configuration. Then click the Security tab. Set Security Type to App Id – Basic Authentication and enter your credentials. Give the key any name. Click Apply.
  13. Click Save.

Calling the REST Endpoint 

  1. Open the ExpenseApproval process in the editor. 
  2. From the palette of actions on the right, expand System and drag and drop a Service action after the Approve? decision.
  3. Double-click the Service action to open the Editor. In Type, select Service Call. Then click the pencil button.
  4. In the Configure dialog, select REST as the Type. Select ExpenseREST for the Integration. Then select ExpenseReport as the resource and patchExpenseReport as the operation. Click OK.
  5. Hide the Property Inspector. Then click the the Service action, click the menu icon, and choose Data Association.
  6. Set the following mappings:
    • expenseReport.mode – mode
    • expenseReport.version – version
    • expenseReport.id – id
    • "Approved" – body.status
  7. Click Apply.
  8. Add another Service action before the Resubmit task. Perform the same tasks as above, setting body.status to "Rejected".
  9. Save, publish, and test the process.