Using Oracle Policy Automation Public Cloud with Oracle Service Cloud (RightNow): Part 3
We are continuing our Lazy Expert series of posts, with an explanation of how OPA Public Cloud, and the rulebases deployed there, can be used within the Oracle Service Cloud application. In case you have missed out on our first part of this series, you can find it here. With the right nudge, our Lazy Expert is not so lazy after all.
Part 1 looked at exploring, deploying and verifying the “RightNowSimple” rulebase to work with the Service Cloud Connection. The rulebase was launched directly using the Interview Session URL.
Part 2 looked at embedding this Interview into the Consumer Portal of Service Cloud so that anonymous visitors to the portal can use this same interview in self-service mode. This is accomplished by publishing an “Answer”, with Interview Session URL embedded in an IFRAME, to the Consumer Portal.
This post will look into embedding another sample OPA Rulebase into the Service Cloud Consumer Portal so that “known” (read logged-in) contacts can use the Interview Session for an appropriate determination to be provided by the OPA Rulebase. The Interview session will be launched in the context of a known user/contact and hence it is possible to pre-seed the Interview with the data from Service Cloud and, once the determination is completed in OPA, save the data back into Service Cloud using the Service Cloud Connector.
- Steps in Part 1 are completed and the Service Cloud Connector is verified to be working fine.
- Explore / Deploy / Activate the “StudentBenefits” sample Rulebase into the OPA Cloud Policy Hub and obtain the Interview Session launch URL. Be sure to specify the correct Oracle Service Cloud connection to be used by this Rulebase.
Do remember to explore the mapped-in and mapped-out attributes in the Data Model used by this Rulebase.
After you have deployed the Rulebase to your OPA Hub, don’t forget to note the URL.
Retrieve the Shared Secret used with the Service Cloud Connection
- The shared secret can be obtained from the Service Cloud Connection administration page. This is used for the purposes of encrypting the URL parameter “user”, as it is launched from within the Service Cloud Consumer Portal. If necessary, a new shared secret can be generated from within this admin page itself.
Deploy and configure the sample OPA Widget to Service Cloud
1. The relevant artifacts (for OPA Cloud Nov 2016 Release) and the detailed instructions for installation can be found on the official documentation website.
2. Download and Save the file Oracle_Policy_Automation_Cloud_Examples_Nov2016.zip and Unzip or extract the contents of the file to a local folder. Bear in mind that both of these URLs will probably evolve over time.
3. Verify and, if required, enable MOD_CP_DEVELOPMENT_ENABLED configuration setting for your Service Cloud Instance. This setting is most likely configured by the Oracle team, during the provisioning of your connected OPA Cloud Instance. If necessary, enable this setting under Configuration > Site Configuration -> Configuration Settings and changing the key value to “Yes”. This will enable you to work with the next steps of configuration within the Customer Portal.
4. Upload the required files to your Oracle Service Cloud instance using any WebDAV client, using the following sequence of steps. Tools you can user for this step include Cyberduck V4.4 (free, recommended by Oracle), WinSCP and even the good old “Mapped Network Drive” in Windows, to work with and explore the Customer Portal files available at the URL https://<your_site>/dav, using the WebDAV protocol.#
For the sake of brevity, these next steps are more focused on OPA. Please refer to the Service Cloud documentation, for the specific development process / best practices to be followed.
a. Configure/update the Shared Secret value into the file “…\customer-portal\widget\opa-helper.php” by placing it into the $shared_secret variable, using any plain text editor.
You will observe from the highlighted code snipped below that this shared secret is used to encrypt the user (contactID) parameter that is passed on to OPA Interview Session through the launch URL. You don’t really need to understand the code, just understand that you don’t want URL parameters that are readable with the naked eye.
b. For Oracle Service Cloud version November 2012 and later, we need to use Customer Portal framework version 3:
- Upload the directory OPAWidget from customer-portal/widget/v3 to dav/cp/customer/development/widgets/custom/opa
- Upload the file opa-helper.php from customer-portal/widget to dav/cp/customer/development/helpers
Note: You must have incorporated the “shared secret” before uploading this file.
Activate the OPAWidget using the “Development Mode” in Service Cloud’s Customer Portal administration page.
- Open the Customer Portal Administration site at https://<your_site>/ci/admin.
- In the menu bar, select “Settings”, then “Set Environment”.
Select Site Mode as “Development” and verify that you are actually browsing the development version of the customer portal:
So you should see something like this:
Now you are ready to activate the OPA Widget that you have uploaded to your environment.
- Navigate back to the Custom Portal Admin Dashboard page.
- In the menu bar, select Widgets, then Browse Widgets.
- On the Widgets page, select Custom Widgets, then opa, and then OPAWidget.
- In the custom/opa/OPAWidget view, with version 1.1 selected, click the “Activate this version” button.
When activated without errors the version drop-down will change to “1.1 (currently in use)”. In the picture below you can see the 1.1 version is activated. You will find it easier to use the search function highlighted rather than scrolling through the myriad of widgets.
The final part of this rather convoluted process is similar to what you did in part two, namely you will now insert something into an Answer. Whereas in the previous example you inserted a bit of HTML that you could make yourself, this time OPA will be added to the Answer using the eponymous widget.
Insert the OPAWidget into an “Answer” in the Service Cloud Customer Portal:
- Create a new “Public” Answer in Service Cloud as shown below.
Select an appropriate “Access Level” on your site for this Answer, to ensure that only logged-in users will be able to access this answer from the customer portal. A logged-in user is necessary for pre-seeding the Contact information while launching the embedded OPA interview session.
- Save the Answer record and note down the Record ID. We will use this Record ID to ensure that the OPA Widget is visible only when this particular answer is accessed by users in the customer portal. In our case, this ID is “134”.
- Edit the Answer Page design to conditionally include the OPAWidget. The page to be edited is detail.php at the path /dav/cp/customer/development/views/pages/answers
I used Cyberduck and Notepad++ as the editor, with the default character encoding as UTF-8. Cyberduck ensured that every save in the chosen editor was updated into the WebDAV development folder immediately. Nice!
As an example, here I have edited the file to only display the Web Determination that we want to display, namely StudentBenefits, when we are showing Answer number 134.
Verify the results in Oracle Service Cloud Consumer Portal
- Search / Navigate to the Answer record in the Consumer Portal, as a logged-in contact/user. If you don’t login, you can expect to see the following warning message:
View the details of this Answer and work with the embedded Interview Session. You will observe that some of the contact information is pre-seeded as you work through the interview session and the final assessment / determination is saved back into Service Cloud.
Assuming you have logged in however, this is what you will see :
Those of you who have followed this sometimes serpentine chapter of our adventures from the beginning will note that I have logged in with a Portal profile of a user called Richard (who might that be?) and the interview has read that information.
Congratulations on getting this far. So we have discovered yet another way to nudge our lazy expert into giving us something useful. In the fourth and final part of this series I will go behind the curtain and work in the Agent Desktop. See you soon!