This blog is part of the series Visual Builder Cloud Service Learning Path. In this lesson we'll learn about how to back your VBCS application with an approval process in Process Cloud Service (PCS). PCS is included as part of Oracle Integration Cloud Enterprise, as is VBCS.
In this tutorial, we'll look at how to create a process in PCS that can handle the approval process for your Expense Report application. Import this application to start the lesson.
Creating the Process
Here are a few key points about the process we are going to create:
- It is based on the Start With Message Approval template that is included in PCS. We will remove a few things to make it easier to work with.
- It contains a PCS Business Object called ExpenseReport that includes some key information that PCS needs to know in order to interact with the VBCS application
- We pass in this info by defining an ExpenseReport object as a parameter to the Start message and then mapping that data to the PCS ExpenseReport. The important thing to remember here is that the argument on the Start message only defines the shape of the data, while the Business Object in the process itself actually holds the data.
Let's create our process.
- In the VBCS Expense Report application, open the Processes tab and click the menu button in the top right of the tab. Then click Design Processes.
- In the top-right corner of the Process Applications page, click Create > New Application.
- Name the application Expense Approvals and click Create.
- Click Start when a message is received. Then select Simple Message Approval Pattern, name the process ExpenseApproval, and click Create.
Configuring the Process
Let's remove a few things and do some basic setup.
- Remove the Notify and Fulfill actions by selecting them then clicking the trash can icon above them.
- When you have exclusive gateways like the one after the Approve Request step, you set one path as being the default path and have to set a condition for all other paths. Let's set the condition for the No path. Select the No path then click the pencil icon.
- In the Property Inspector that opens at the bottom of the screen, click the pencil button next to the Condition field.
- Expand ExpenseApproval, select TaskOutcomeObject, and click the Insert Into Expression button.
- Fill out the rest of the expression to say TaskOutcomeDataObject == "REJECT"
- Click OK.
Creating the PCS Business Object
Now let's create our ExpenseReport business object that will hold our data from the VBCS application
- In the left sidebar of the PCS window, click Business Types.
- In the top-right, click Create > New Business Object.
- Set ExpenseReport as the name and click Next.
- Insert the following fields, all strings, and click Finish.
- id​
- name
Note that id is an integer but because of some problems PCS has when dealing with integers we're just going to treat it as a string.
Configuring the Start Message
So above we created a business object shape. Now we have to:
- Use that shape to define the input parameter of the process
- Create an instance of the business object in the process
- Map the input parameter to the business object instance
Let's do that now.
- Double-click the Receive Message node to open the property inspector.
- Click the pencil button next to Define Interface.
- Click the + button in the Arguments Definition list. Change the name to startPayload.
- Click the down arrow next to string in the Type column.
- Expand Components and select BusinessData.ExpenseReport.
- Click OK.
- In the top-right of the Process window, click Data Objects.
- Click Add. In the dialog, set the name to expenseReport. Under Data Type, choose Business and select BusinessData.ExpenseReport. Click Create.
- Close the Data Objects dialog.
- Click the menu icon on the Start Message and choose Data Associations.
- Expand startPayload on the left and ExpenseApproval > Data Object > expenseReport on the right. Then map the id and name fields by dragging them onto the canvas in the middle.
- Click Apply.
Running the Process in Test Mode
Now let's save the project, publish our version, then run activate it in test mode. It's best to save and publish every time you make a change in the process and want to test it in VBCS.
- In the top-right of the Process window, click Save.
- Click Publish at the top of the page. Add a comment in the Publish dialog and click Publish.
- Click Test in the top of the page. In the Test window, click the Activate button. Confirm the dialog that asks to add you to all roles.
Hopefully the validation window doesn't show any errors, but if so fix them in the process and save and publish again. The Running instances window will show you instances of the process that you launch from VBCS. We'll look at how to debug problems with the process in a later chapter.
That's it! You're ready to hook this up to a VBCS Application, which we'll cover in the next chapter.