Showing posts with label VB. Show all posts
Showing posts with label VB. Show all posts

Friday, October 20, 2023

#993 VB invoking OIC3

This post covers invoking OIC from VB, both from an VB as part of OIC and VB standalone perspective.


Step 1 is to create a confidential app, the previous post went into great detail on how to do such. I will just give the outline here -

  • Create confidential app in IDCS
  • Allowed Grant Types - Client Credentials and Refresh Token
  • Redirect URL to https://yourOIC/icsapis/agent/oauth/callback
  • Scopes - the 2 scopes of your OIC app
    • ...ocp.oraclecloud.com:443urn:opc:resource:consumer::all
    • ...ocp.oraclecloud.com:443/ic/api/  
  • Save the client id and secret for future use
Now give this app access to the default OIC app, created when the OIC instance is provisioned. It is located here -

 






As you can see, I've added the app to the Service Developer role - I'd forgotten this step, but my esteemed colleague, Antonio Botella reminded me.


Now to Visual Builder - here I am using VB Standalone - I edit the Server settings to point to my OIC instance.



This is now available in the VB apps designer - 

I now create a Service connection - 







I choose the following simple integration - 


I then test - 






















Monday, July 17, 2023

#976 OIC 3 Visual Builder invoking OCI Process Automation

Invoking OPA from Visual Builder is very similar to invoking OPA from OIC3, see my post here on how to do the latter.



Here is the process I will invoke for Visual Builder - 




Request payload is as follows - 














So to the steps for Visual Builder invoking OPA - 

Step 1 - Create an IDCS app for OPA

This is described in the post mentioned above. This will give you your client id and secret.

Step 2 - Get the required url for invoking process 

The format is as follows - 

https://yourOPA.oci.oraclecloud.com/process/api/v1/process-instances?applicationName=yourOPAAppName&version=1.0&processName=yourProcessName

So, for me - application name is OrderApprovals and process name is OrderProcess.

Step 3 - Create an App in Visual Builder 

First thing I do is add a Business Object with the same fields as the request -
















Note the pre-seeded fields - createdBy etc.

Step 4 - Define Service Connection in Visual Builder 

This will be based on the OPA REST api discussed above.




As you can see, Authentication is set to OAuth 2.0 Resource Owner Password Credentials.

You provide client/id secret as well as userid/password (of a valid OPA user).

Scope is set to  
https://yourOPA.oci.oraclecloud.com/process offline_access

Token Url is set to https://yourIDCS.identity.oraclecloud.com/oauth2/v1/token


Step 5 - Build a simple app


My VB app is very simple - it allows me to create orders - 


Note the extra button in the Create page - Send for Approval. This will invoke the OPA api.


Step 6 - Test it





I check in Process Workspace






Monday, March 6, 2023

#956 OIC 23.02.2 update - Welcome Visual Builder


Another major step on the way to OIC Gen2 parity - OIC now includes Visual Builder - 



In this post I will detail the creation of a simple VB app that invokes an OIC integration, so let's check out which integrations I have on this instance. 















Let's invoke AA-PostgreSQL-Demo from VB. This creates a row in my Orders table. first step is to create a service connection in VB to OIC Integration. We have OOTB access to our activated integrations, as you can see - 





As already mentioned, the PostgreSQL integration creates an order in my PostgreSQL DB. 

So I begin by creating a simple VB app to manage my orders. I create an Orders Business Object, then I generate a CRUD UI for my Orders. Note that Visual Builder allows me to create native mobile and web apps and this very easily. When we say low code, we mean LOW! 


The final step is to amend the page workflow to invoke the integration. I will add this to the create page - Save - action chain.  



I will add the Integration invoke in the success path, after Fire Notification.






I set the body as follows - 






Let's test it - 











I check Integration Tracking -


I then check out the orders table - DB - 





Enabling VB in your OIC instance is very easy, only a couple of steps - 

1. Create a policy to allow OIC admin to manage Visual Builder -
allow group <admin_group> to manage visualbuilder-instance in compartment  <compartmentId>

2. Click the Enable link for Visual Builder on the Integration Instance Information tab.


Summa Summarum

This is the penultimate step on the way to OIC Gen 2 parity as OIC now comprises - 

  • Integration
  • File Server
  • B2B
  • Insight
  • Visual Builder

But it's not just parity - OIC includes many compelling new features, not available in OIC Gen2. So get kicking...






Tuesday, August 2, 2022

#918 Exposing OIC Process Task Payloads in Visual Builder









I am still looking at the extend Opera use case - Move Reservation. I showed how to display Process task data in the last post. My effort there was very basic - try and fit in all the salient task details in the task name. You can check out the previous post here

So now I want to have the same approach as the OIC Worklist app - namely, a list of tasks with the ability to select a task and see its payload details. Once I've selected the task, I want to be able to add comments and either approve or reject the proposed move.

Essentially, I require the following api calls to OIC Process -

  1. getTasks
  2. getTaskPayload
  3. addCommentToTask
  4. updateTask

Now let's look at the anatomy of the first page - 







Here I have 2 tabs, one for Processes and one for Tasks. Let's look at the Tasks tab - the table shows my MoveReservation tasks, via -
















and then select the relevant task fields.

Notice the button - View Task Details - this will retrieve the task payload from OIC process for the currently selected task. It will display the payload and allow the user to approve or reject the request. The user will also have the ability to add  comment to the task.

So essentially this page will require the 3 other api calls - getTaskPayload, updateTask and addCommentToTask. I have decided to create 3 service connections for these -



 






The highlighted one is for getting the task payload, as you can see, I did not change the default name; I did for the other 2.

Starting point was the OIC REST api docs - available here


 I checked out the Task apis and found - 





I used this to create the VB service connection - final step was to test the connection -











Note, the default format returned is xml - 


 









I get the json format by adding the header - 









I do the same in Visual Builder - 







I then create a type for this specific MoveReservation payload response -














I also create the other 2 service connections based on the following OIC Process apis - 







The REST api docs are comprehensive and include payload examples which one can use when testing the service connections in VB.

To approve a task - 

{

   "action":{"id":"APPROVE"} 

}


To add a comment to a task - 

{
  "commentStr":"This customer hates being moved",
  "commentScope":"TASK"
}

commentScope can be either TASK or BPM (process level comment).

Now to the actual navigation from the start page to the details page - the button action chain is as follows - 






















Assign Variables - assign the task id from the selected row in the table - VB provides this OOTB - 





















Call REST - invokes the get payload api
Assign Variables - assigns the response to variables that are mapped to the fields in the details page
    Navigate - to the task details page - main-task-form, shown below - 













As you can see, I have invested no time in making this look pretty - that's your job!

Finally, let's look at the action chain for the Approve button - 





Again, very simple - Firstly, check if comments have been entered, if so, update the Task with those comments, then update the task status via the ProcessUpdateTask REST based action.

Let's try out the whole use case -





The Majestic Hotel in Dublin is full, so we have to move Niall.

Let's move him to the Hollybrook - 






















Niall is a Platinum level guest so a process has been started for management approval.

Now to the VB worklist app - 












Manager clicks on View Task Details - she adds a comment and clicks Approve -




























I can validate this easily in the OIC Process Workspace, filtering on completed processes -










I appreciate this is a simple example, but it does show the power and flexibility of using OIC's Visual Builder component as the front end for your process flows.