Tag: Self Study

Oracle Policy Automation – JavaScript Custom Search

Oracle Policy Automation – JavaScript Custom Search

As many of you will no doubt  have discovered, the recent version of Oracle Policy Automation now comes equipped with a complete JavaScript Extension API. Simply put, we can create custom Labels, Input Controls and so on using JavaScript objects. Our code, which is part of the Project, is detected at runtime and executed by the JavaScript engine in your browser. In this post we will look at JavaScript Custom Search and how to use it in your own projects.

One of the most fun parts of this new API is of course discovering ways to use it. Following on from the post a couple of weeks ago, I thought I would share an example of using the customSearch. The principle behind using JavaScript Custom Search in Oracle Policy Automation is very easy to understand. Most of us are familiar, for example, with the concept of typing in a little bit of text and then the browser completes it, providing a drop down of potential choices. There are a myriad of ways and places to see it on the Internet. Perhaps you are searching for a street, so you type in the postal code and sure enough, your website might propose the list of streets in that area.

Whatever your reason for using it, here is an example you can play along with. Since we need a data provider, we are going to use JSONPlaceholder – a wonderful fake REST API that you can use for testing just this sort of thing. It is free and easy to use. We can call various different endpoints and the server will report back with fake data. We can use all the verbs and many different sorts of REST call. Great!

What else do we need?otn We need a JavaScript editor (step forward Notepad ++ for example) and the August 2017 edition of Oracle Policy Modeling. Before we look at the code however, remember the following caveat : anything you read here is for entertainment and education purposes only and should not be relied upon for any reason or situation.

Let’s get a big picture first. You are going to be coding three things

  1. The Search
  2. The Commit, which you can think of as “any post search processing”
  3. You will be building a set of records to be passed to the callback function

JavaScript Custom Search

The search itself, as I mentioned before we will use the JSONPlaceholder service. I have selected the users endpoint, so that I can fire off a query like “‘/users?q='” and pass the text string entered by my user. Hopefully the service will return some people.

JavaScript Custom Search Step by Step

The processing and preparation will involve, purely for the purpose of demonstrating the principles, laboriously removing any elements of the data I am not interested in. In fact I am going to delete everything except the name and the email address. The callback function expects a set of data that respects a specific format: “This can either be an array of strings or an array of objects where each object has a text property.” So now you know why I wanted to demonstrate the following

  1. Renaming a property in the object
  2. Using the other property, email, in the Commit.

Here is the first part, basically I am :

  1. getting the text from the user and then passing it to the REST endpoint in the form of a GET.
  2. The response is coming back at me as a bunch of objects, which I am going to loop through and trim by removing unnecessary stuff.
  3. Then I am going to convert it into an array of results for our JavaScript Custom Search.
  4. Then I call the callback function with the array passed in.

JavaScript Custom Search Script

The user can now select one of the values I have returned. When they select their chosen value, the commit will handle it:

JavaScript Custom Search Commit

In the picture above you can see the value which is passed in actually included the email element from the REST call, so I am free to use it (and any of the other bits I didn’t delete in the previous steps) to populate other attributes, such as the email address.

To help you make sense of all of that, you will find below a video which guides you through the steps and shows the different elements.

Have a nice day and I hope you enjoyed reading an example of JavaScript Custom Search in Oracle Policy Automation.

JavaScript Custom Search Video

Update (December 2017)

I forgot to mention that if your input control is displaying an attribute that is not of type text, this code will not run. It works (perhaps self-evidently, but for completeness I reiterate it) only on text attributes.

Getting Started with Oracle Service Cloud

Getting Started with Oracle Service Cloud

Getting Started with Oracle Service CloudA question from the bag of “virtual mail” that gets delivered here every day (even on Sunday). E.D writes to us from Penn State with a question that is on quite a lot of people’s minds. Can the book Getting Started with Oracle Service Cloud get you certified? Or, to be fair, this is the question exactly as it was asked :

“I’m wondering if your new book for Oracle Service Cloud is enough knowledge to pass Oracle’s certification exam? I’m an ex-Oracle employee with 20+ years of Service experience, but never had the opportunity to get the service certifications. And I can’t afford $5k to buy the online training subscription. Any advice you might have is appreciated!”

Now it won’t come as a great surprise that I am not going to straightaway jump in and say “Yes of course!“. After all, I didn’t write the book to serve as a certification tool. In fact, I write that in the preface of all my books to make sure that people don’t think I am offering a sort of magic shortcut.

It’s probably better to answer this in a practical way. Here are the subjects of the OSvC Implementation Essentials certification examination, with, alongside, relevant chapters of the Getting Started with Oracle Service Cloud book, and some comments from me.

I hope this helps. You should however bear in mind that the Exam does ask very detailed questions, so it is a pre-requisite to have had a fair amount of hands-on experience. Just reading the book would not be enough.

Exam Topic Book Chapter & Comments
Create and implement Workspaces Chapter 4
Create and implement Navigation Sets Chapter 5
Create Customizable Menus Chapter 4
Create Agent Workflows Chapter 11
Create Agent scripts within the Scripts Explorer Chapter 12
Create Profiles Chapter 5
Create Staff Accounts Chapter 4
Describe Password configurations and their functions Chapter 3 and probably somewhere else
Describe typical answer management components and usage Chapter 9
Manage Search Priority Words Chapter 15
Create and manage Word List Files and the Dictionary Chapter 15
Create and manage Access Levels Chapter 4 & 5
Describe Custom Fields and their usage Was planned for another release.
Create Business Rules Chapter 10
Explain Standard Text and its application Chapter 8
Explain Service Variables and their application Chapter 6
Create and manage Service Level Agreements Chapter 10
Configure Cloud Monitor Was planned for another release.
Configure Custom Objects Was planned for another release.
Describe incident management Chapter 8
Manage Message Bases Chapter 3
Manage the System Configuration settings Kind of everywhere
Explain Mailboxes and their usage Chapter 14
Configure Message Templates and System Interface configurations Chapter 14, Chapter 16
Explain Product, Category, and Disposition usage Chapter 8
Create and manage Guided Assistance and its application Chapter 13
Explain the File Menu and CX options features and their usage Chapter 2
Create and configure Custom Reports  

Was planned for another release.

Create and manage Scheduled Reports Chapter 17
Create and manage Surveys and Mailings Chapter 14
Create and manage Chat configurations and rules Chapter 16
Create and manage Co-Browse configurations Chapter 7
Customize and manage Templates, Pages, and Themes Chapter 6, Chapter 7
Describe Customer Portal deployment protocols Chapter 6
Customize and manage Tags, Widgets, and Assets Chapter 6


New OPA Quizzes : Helping you learn Oracle Policy Automation

New OPA Quizzes : Helping you learn Oracle Policy Automation

New OPA Quizzes : Helping you learn Oracle Policy Automation

 learn Oracle Policy AutomationWe’ve begun rolling out our latest feature, namely interactive quizzes for you to test yourself on Oracle Policy Automation and Modeling. We are always looking for ways to help you learn Oracle Policy Automation.

The first two chapters are now live on the site, and we will be adding more and more as the weeks go by. The quizzes are free of course and we maintain a leaderboard for each quiz so you can see how well you have done.

In the next few weeks we will also be publishing the complete chapter set as one, giant quiz for you to use in your preparation for your next interview, or even as a preparation for your upcoming certification examination if you are planning on taking one. In any case we hope that you enjoy them and have fun with them. Share them with your friends as you  learn Oracle Policy Automation.

And while you are at it, reward yourself with a mug from the Shop. Maybe we will give away a few mugs at the end of the year to the Leaderboard Winners. Yes, that’s a nice idea. At the following page you will find the OPA Quizzes and the links to the OPA Quiz Leaderboards.

Back to Basics 2 – Oracle Policy Modeler Articles

Back to Basics 2 – Oracle Policy Modeler Articles

Articles are a thorny point, since not all languages have the same concept. But the chances are that if you are working in a latin-based or greek-based language then you will have the concept of “the”, “le” or “la”, or “der”, “die”, “das” and so on. Writers who jump into Oracle Policy Modeler, especially those from other less natural-language focussed tools, tend to write rules that don’t have any articles, or that use the indefinite article. So what should we look out for in the area of Oracle Policy Modeler Articles?

Basic  Idea #2

Articles don’t matter.

Yes they do. Very much so. And perhaps the most insidious problems occur when there is no defined strategy at all, and everyone does what they feel like. For example, consider the following rule.

Oracle Policy Modeler Articles

Notice the lack of article. This rule will validate and work, despite it being a long way from natural language. However, what usually happens next is the entity model becomes more complex. So the designer adds an entity. Either “the customer” or “a customer”.


Notice how the original attributes, customer status and customer is always right, have remained attached to Global rather than the new Entity, since they didn’t contain the exact text “a customer”.


Now in the Debugger we can see the side effect in the language generation.  A customer looks weird. The customer would have been far more readable. And in the Interview debugging session, it looks pretty nasty too.


And of course at the same time, our Interview does not really work because the attribute is not applied to each customer, just to Global.



If we had adopted a common sense approach and created all of our attributes with the more natural “the customer…” we would have had less issues with matching attributes to Entities and better natural language generation, and last but not least it would have been far more normal to read in Word. Oracle Policy Modeler needs to have definite articles both for Entity names and attribute definitions. 

  • Customer is right – not natural language
  • A customer is right – which customer?
  • The customer is right – natural, specific to one customer



Logo by Southpaw Projects LLC