Posts

Calendar- Date Time in PCS - Header

Dealing with Dates and Times in Oracle Process Cloud Service

Introduction

Oracle Process Cloud Service (PCS) is great! You can build process-based applications in two shakes of a lamb’s tail, much quicker than most Low Code platforms in the market. Of course, you can’t, or at least shouldn’t, develop any “normal” master-detail CRUD application with Oracle Process Cloud Service. If you need this kind of applications perhaps Oracle Application Builder Cloud Service will suit you better, but for process-centric applications, it’s a hard to beat tool.

As you may know, Oracle also has an on-premise product, called Oracle BPM, which features a similar codebase, but it features a more advanced and complex UI and it takes a bit more time to produce a similar application.

Oracle PCS really shines for its simplicity and ease of use, because the UI was streamlined and is much more focused. However, all this optimization and streamlining led to decisions to simplify the UI and some features present in Oracle BPM are not present in Oracle PCS. Most of them we won’t really need except for 1% of all our application needs, but a few are a more common necessity. The capacity to use functions to manage and operate dates and times fit this last set.

Oracle BPM allows you to manipulate dates using several options, with Data Associations and Script tasks perhaps being the most common. In Oracle PCS, the Data Associations don’t allow you manipulate dates nor retrieve the current Date / Time, and script tasks plain and simply are not available.

It’s possible to create services that do whatever we need to do with dates and then call them in Oracle PCS, but sometimes we want a more direct approach.

The Use Case

Let’s consider the following case:

We have a simple approval process with 3 steps. Every time there’s a response to a task, we want to record which response was and at which date and time it was made. We also want to show this information to the user, in the task web form, and we want that the whole process takes a calculated amount of time as the most, with it automatically finishing up after that amount.

Something a bit like this:

The Use Case process

The Use Case process

And the web form:

The Use Case web form

The Use Case web form

 

Notice that Oracle PCS automatically creates a data object in the process, of the same type as the start form.

Automatically created data object corresponding to our web form

Automatically created data object corresponding to our web form

Also, all task data associations are done automatically, without the need to do this manually, when you set the task form.

Choose the web form for the task to use

Choose the web form for the task to use

Automatic Data Associations - Cool Stuff!

Automatic Data Associations – Cool Stuff!

Remember that we want to fill each of the decision fields with both the Outcome of the last response and the date and time of that response.

If we try to so it through the web form functions, you’ll notice that you can only set a field to the current date/time. This would change the value of the field “When?” every time the user was shown the form. This is not what we want.

Trying to automatically fill this field

Trying to automatically fill this field

... and you can. But that's not what you want.

… and you can. But that’s not what you want.

Also, you can’t do calculations between fields which are of type date/time. Let’s say you also want a new field which tells you the number of days between the date of the first decision and the last one. How can you calculate this in the form?

Common sense would lead us to try to subtract the value of the field that holds the date/time of the first decision, from the value of the field that holds the date/time of the last decision. Unfortunately, this doesn’t work, as you can see below (31 May – 18 May = 0)

Our form doesn't calculate the Nr of days correctly

Our form doesn’t calculate the Nr of days correctly

The Nr of days calculation function

The Nr of days calculation function

We can also try the data association route, but, as we can see from the image below, there are no functions to deal with dates in this part.

Data Associations Expression Builder - Data Objects

Data Associations Expression Builder – Data Objects

Data Associations Expression Builder - Operators

Data Associations Expression Builder – Operators

Finally, as there are no Script Tasks, as you have in Oracle BPM, you can’t actually program this in your process.

So, how can we do this?

We cheat!

Let’s try to use a Business Rule for this. By placing a Business Rule after each task, we guarantee an immediate execution right after the decision is taken and we record the rule execution date/time as the decision date.

Business Rules Calendar objects

Business rules get an input, do some magic, and produce an output… pretty much as any other task in our process. What makes them special is the amount of magic one can do inside them.

When we create a decision, we can use a lot of Java functions, including a few related to treating dates and times.

So we create a Business Rule, setup the input and output as objects of the type of the web form (this makes it easier to do the data associations) and, once we enter the decision screen we just create a new General Rule.

Creating your General Rule

Creating your General Rule

Then we create a true condition in the “If” part of the rule, as we want it to always execute, and in the “Then” part, we specify that we want to modify the object that we specify in the Drop Down List (in the example below the object is called “Other”).

Our Rule Configuration

Our Rule Configuration

We click on the pencil icon and choose the field in which we want to do the date processing (click on the magnifying glass). We are taken into the Condition Browser, where we can access the Expression Builder

Condition Browser

Condition Browser

Business Rules Expression Builder

Business Rules Expression Builder

As you can see, this expression builder is much more advanced than the one available in the Data Associations dialog, with a few more tabs, including the Functions.

In here we can do calculations with our dates, set them as we want.

So we’ll grab the CurrentDate.date.time calendar and apply the JavaDate.to datetime string to it, like so:

Our Date expression

Our Date expression

And that’s it. This will calculate the current date and time, put it in the output object, which is our web form.

Now we only need to repeat for all tasks. A bit like this:

Our Use Case process with Business Rules

Our Use Case process with Business Rules

I hope that this article can help you do more complex calculations and extend the normal use of Oracle PCS, to cope with more business scenarios.

If you have any questions please place them in the comments box below.

José Rodrigues

P.S: All of this could also be done with the help of ICS, JCS or ACCS. I’ll write about it in a couple of weeks.

Post header image by Sebastien Wiertz

Building Case Management Patterns in PCS

Implementing Case Management Patterns using Oracle Process Cloud Service (PCS)

Hi everyone and welcome to the second part of our article on implementing Case Management (CM) patterns with Oracle Process Cloud Service (PCS).

On the first part, we learned a bit about the concepts around Case Management and we (barely) started a process on PCS. We’ll use this process now as a container to implement the ad-hoc nature patterns.

The First Rule of Fight Club

First Rule Fight Club

The First Rule of Fight Club © 20th Century Fox

“We do NOT try to implement Case Management on PCS!” – That’s the first rule. What we will do is implement a small subset of behaviors, which will offer some of the advantages of Case Management.

The second rule is that we have two buddies that can help us in this quest: Database Cloud Service (DBCS) and Integration Cloud Service (ICS). Some of the behaviors will need a bit of persistence, which implies placing a lot of case metadata in some control tables, hence the DBCS, with the ICS being used to handle all integrations. ICS may not be necessary but makes integration easy as peach. Use them extensively!

As we’re trying to “hammer a screw”, things will not be pretty. This is a workaround. Please take it as a way to implement these behaviors.

Regarding the first rule, the set of behaviors which we’re going to implement is the following:

  • Ad-hoc Task and Process Invocation
  • Milestone and Stage Trigger/Set
  • Event Listeners

Let’s Start

So, last time we created a message based process

Again, the process must be created with messages events, as these will allow it to be called by other cases in an asynchronous way.

The first thing we do is get a case ID. This ID should come from another system (for instance, a database) and will be used to guarantee correlation between all elements of the case. We’ll get into to that further ahead.

Then, what we typically do is set up a business rule (decision table) or a database table, in which we predefine some configurations, such as Overall Process SLA, Milestone SLA’s, etc… This will allow you to change the way a process/case behaves, without actually having to change the process model.

Centralized Control – The Case Main UI

Now, we’re going to need a UI, from which we should be able to invoke whatever actions I want, in the order that I want them.

For that, we’ll build a Human Task and implement the respective form, using the Web Form technology. In fact, you can build your UI in whatever technology you want and then use the REST API’s to perform the task actions, but in this case, we did it with the web forms.

Here is an example of a Custom UI, using Oracle’s Alta UI, and delivered by Link Consulting’s BPM Framework (Very cool product! Ask for a demo at linkconsulting.com/oracle :))

No matter what technology you use, you should guarantee that it contains the following information:

  • All business relevant data
  • Access to documents to view, upload or download.
  • A list of all available milestones, their status and moment in which the last status was set
  • A list of all previous actions in the case, including the famous “Who did what and when?”
  • A selector of all possible actions available at that moment
    • Typically you’ll want to restrict the actions you can do at any moment, based on the actions performed before and the milestones reached, i.e. the case state
    • The list of possible actions is determined through one of two options:
      • either we implement this logic outside and then invoke it as a web service, for instance in the database
      • or we implement it by using Business Rules.
    • In both cases, the set of possible actions must be determined prior to entering the Human Task

Main Case Loop Handler

The idea of having a centralized control is complemented with a loop handler. This will ensure that the process keeps coming back to the Case Main UI with each action taken.

We do this by creating a container, in this case, an embedded subprocess and then placing both the activity that determines the allowed actions and the Case Main UI. Then you evaluate the action taken and the case state, determining if the case is now resolved, canceled or if it still continues, looping back to the embedded subprocess in this case.

With each loop iteration, and because this is a case, we must check if the changes in the case state or milestone state will trigger automatically any actions. For instance, resolving a dispute in customer service by offering the customer some money should trigger automatically a bank transfer and a notification by e-mail both to the customer and to the support supervisor.

 

So we need to implement this verification into the Main Case Handler. First, we validate if the last iteration generates any automatic action. We do this by invoking a service that implements this logic. In our example, we did the validation in the Database, through a stored procedure that checks the case data and understands if any automatic action is to be taken. Then we have a branch: If there are any automatic actions to be taken, the process just takes them. If not, the process collects the user allowed actions based on the current case state and them spawns a new instance of the human task Case Main UI.

Do notice that the automatic actions may change the case state or milestone state, in which case there may be further automatic actions to be taken, and so on. This may lead to infinite loops, so be careful when setting the conditions that lead to automatic actions.

The Case Action Controller

After the process/case determines that an action is to be taken, either automatic or manual, we then need to take it in such a way that the process/case doesn’t stop there waiting for the action to be completed. In a normal case management scenario, a user can trigger multiple new tasks without needing to finish the previous ones. So we need to allow multiple actions to run in parallel.

Also, we may want to have some restrictions on how a given task is invoked. Let’s say that, for instance, you want to ask your supervisor for his approval on a compensation for a customer. So you trigger the Action “Superior Approval”. Now you want to be able to do other actions, for instance, to contact the customer, but you don’t want the system to allow the user to trigger another “Superior Approval” action until the last one was completed.

This is what your Case Action Controller does. It controls the actions that can be taken and in what conditions it can take them.

Right now you’re probably asking “Huuummmm, but isn’t that what the ‘Get Automatic Actions’ and the ‘Get Allowed Actions’ do?” Well, kind of… We use the case main controller to do a few specific things:

  • Control the cardinality of the execution of actions – This is done with a Service Task
  • Allow parallel tasks to happen – We use an inclusive gateway, and we model all possible actions inside it.
  • Set Case Stage status – This is done with a Service Task

Our Case Action Controller looks like this, in a very simplified way

Notice that we use Throw Message Events to trigger the actions. This allows the process/case to trigger this, but then immediately follows to the end of Case Action Controller, without waiting for that action to be concluded. This is how we implement the semantics of an ad-hoc invocation of a process or task, as many times we want, in the order that we want, and not using a predefined, well-structured process.

Implementing our tasks and processes

To implement our tasks and processes that are to be called inside our Case Action Controller, we use the exact same pattern. A task is implemented with a message-based process that only has that task in it.

For processes is exactly the same, but instead of having a single task inside the process, the whole process logic is in it.

Milestone and Stage Trigger/Set

In regards to updating the Milestone and Stage states, we do it through web service invocation and directly update the underlying database. We build a table for Milestones and one for Stages, which include who did what and when. Every time we need to update a Milestone or a Stage state, we just send it to the DB, through the use of REST web services (DBCS features ORDS). This is done by placing service tasks where we want them to be updated.

Updating Milestones and Stages is the way we can understand how a case is progressing and what actions can be taken at any moment, manual or automatic.

Event Listeners

There may be times in which you would want to listen to events and trigger a case activity based on those events. This is implemented in CMMN with the use of Event Listeners, and are represented like this.

The first one is a human event listener. In this case, it triggers a task called “Request Help from Colleague”. In PCS we implement this behavior as we mentioned before: invoking a message based process that only has this task inside. It’s like invoking an Ad-Hoc task.

The second one is a timer event listener and it’s a bit trickier to implement because PCS doesn’t offer that many tools to calculate dates and times. Sometimes you would want to do date/time calculations, and PCS isn’t very cooperative in this subject. Comparing with the on-premise product (Oracle BPM), it’s very limited. There are workarounds for this (think of business rules), but we should try and avoid them.

What we typically do is we create a boundary timer event and attach it to either the Main Case embedded subprocess or a given task, and set the timer using the interval condition.

In the case shown here, the timer is attached to the embedded subprocess in a non-interrupting way. When it triggers, it just sets a given milestone. As the event is non-interrupting, the execution stays where it is.

Putting it all together

Adding all of this into a PCS application will render your case-like processes. We built an example on a small project to handle baggage damage claims for airline and airport handlers. The corresponding CMMN model was something like this:

Complaint CMMN model

Complaint CMMN model

And the corresponding PCS main process was this one.

Case Management using PCS - Part II - 14

PCS implementation of the case

Conclusions

So we hope this article helps you build some less-structured processes using Oracle Process Cloud Service, and that the limitations of not having case management (at least at the moment of publication) may be overcome, to deliver more value to your organizations.

As always, feel free to reach us with your comments and questions. We’ll try to answer that as quickly as possible.

More articles are in the pipeline and you’ll definitely hear from us in the next few weeks.

Until then

Maverick (José Rodrigues)

This is a cross post with Link Consulting. For more Oracle Middleware related posts, please visit http://www.redmavericks.com

post header image by Alden Jewell

Case Management using PCS

Case Management Patterns using Oracle Process Cloud Service

Hi and welcome to a new article on Oracle Process Cloud Service (PCS).

This time, we’re going to address some use patterns that may seem difficult to implement using PCS, and tackle the need for unstructured parts of the process, which is to say, parts of the process that can’t be previously modelled because, well… we don’t know how they’ll turn out.

Take for instance a complaint to your customer service department. You’ll never know, in advance, what kind of complain it will be, or if you need one, two, five or fifty interactions with the customer, or if you need to get approval from department A or B to try and compensate the customer, or even if any legal action will be needed with a supplier of yours, after they failed to compensate the complainer in due time.

So, you see, there are some elements that may render part of your process impossible to predict, at least in terms of activity sequence. You know that these may take place at some point in time in the process, but you can’t plan ahead and model the exact activity sequence (“A” will happen after “B”).

To handle this type of less structured processes (I don’t like the term “Unstructured”, because they have a structure), there’s a discipline called “Case Management” (CM). CM handles the choreography of this type of processes, called Cases, guaranteeing that the activities that are part of the process are executed at the right time and when conditions permit it.

For the remainder of the article, please consider the terms “Case” and “Process” as interchangeable, the term “Less structured Process” as equivalent to Case, and the term “Structured Process” as equivalent to a predefined flow-controlled Process (BPMN process or equivalent).

The main idea behind CM is that instead of the process model determining the next action to be taken, it’s the worker who, actually decides what should be the next best action to perform in each situation, using his experience.

This is not to say that the worker can just do any activity at any time. Typically, there are specific business rules that enable or disable a given activity based on the current data and events associated with a specific process. However, these rules can be as tight or as flexible as we may need.

Case Management Patterns

The idea of the article is to give you the tools you need to implement Case Management patterns using Oracle PCS. This is not to implement Case Management in PCS, but just some case management behavioral patterns. Parts of what is “Case Management” will not be addressed in any way, but things like Ad-hoc process/task calls will, and this is sufficient for most needs.

Short Summary of Case Management Modelling Notation (CMMN)

Just as we have BPMN as a standard way to model structured business processes, OMG (Object Management Group) also defined a standard to model Cases, called Case Management Modelling Notation, or CMMN.

In a short summary, the most meaningful objects are:

  • Case – It’s our main object process all other objects are inside this one.
  • Stages – You can see it as a group of activities that represent a business concept.
  • Tasks – represents work to be done. Can be Human tasks, Process Tasks (call a structured process) or Case Tasks (call other cases). These can be mandatory or optional.
  • Events – Represents something that happens that is significant for the case: e.g. a new file is added to the case, or someone who applied for a loan at the bank suddenly dies.
  • Sentries – Criteria that need to be verified in order to instantiate or complete a task.

As with BPMN, you combine these objects to model the case behavior graphically.

Complaint CMMN model

Complaint CMMN model

For an introduction to CMMN, I suggest the following references:

  • Case Management Modeling and Notation – Knut Hinkelmann

http://knut.hinkelmann.ch/lectures/bpm2013/12_CaseModeling.pdf

  • Introduction to the Case Management Model and Notation (CMMN) – Mike Marin

https://arxiv.org/pdf/1608.05011.pdf

  • There’s an excellent book in the subject. You can find it in the link below.
    • Oracle Case Management Solutions – Léon Smiers, Manas Deb, Joop Koster, Prasen Palvankar

https://www.crcpress.com/Oracle-Case-Management-Solutions/Smiers-Deb-Koster-Palvankar/p/book/9781482223828

First Steps

The first rule is that we need to be able to start/invoke cases whenever we want, from whichever channel we want.

As we’re going to use PCS for this, we first need to create a new Application

Create New Application - Step II

Create New Application – Step II

Let’s call it “Complaint Case”.

Create New Application - Step II

Create New Application – Step II

Now, we create a new process in it. The process needs to start and end with a message event. This is what will allow us to reuse this when we want. Please, do not use None or Form events to start it.

Create New Application - Step III

Create New Application – Step III

Create New Application - Step IV

Create New Application – Step IV

In the next article

In the next article, we’ll address specific implementation patterns in Process Cloud Service and the setup of the data structure that facilitates Case behavior.

Until then, have a great week!

Maverick (José Rodrigues)

This is a cross post with LinkConsulting. For more Oracle Middleware related posts, please visit http://www.linkconsulting.com/oracle

Post Header photo by doug rattray

Travel Request in PCS - Wrapping it up!

Video – How to build a Process Cloud Service Application (Business Travel Requests) in 40 minutes – Final Part – Wrapping it Up!

Hi,

Welcome to Red Maverick’s sixth video, the third of the Business Travel Request Management Series.

In this series we’ll guide you on how to build a complete, working BPM application using  Oracle’s Process Cloud Service.

For this part, the focus is on doing the final configurations and connecting all the dots, making the application fully functional.

This scenario and video was first prepared by me for Link Consulting‘s Process Cloud event, that was held in July 2015.

Enjoy!

Cheers

José Rodrigues, a.k.a Maverick

Post image by alobos Life

TravelRequest Business Rules

Video – How to build a Process Cloud Service Application (Business Travel Requests) in 40 minutes – Part III – Business Rules Setup

Hi,

Welcome to Red Maverick’s fifth video, the third of the Business Travel Request Management Series.

In this series we’ll guide you on how to build a complete, working BPM application using  Oracle’s Process Cloud Service.

For this part, the focus is on setting Business Rules using Oracle’s PCS, to fine tune the process flow path, depending on process data.

This scenario and video was first prepared by me for Link Consulting‘s Process Cloud event, that was held in July 2015.

Enjoy!

Cheers

José Rodrigues, a.k.a Maverick

Post image by N i c o l a

Process Timers

Process Timers – Controlling the time in which your process executes

Hello everybody,

Following up a series of questions around setting timers in the Oracle Community forums, I decided to write this article to try and guide their use and how these can be used to control process execution.

Let’s start!

The Use Case

We’ll begin by setting up the scenario in which we’ll have to control our process flow.

Imagine that you want to have a part of your process that executes immediately if the current time is between 08:00am and 04:00pm (16:00 hours for us Europeans), or wait until 08:00am if it’s outside that interval.

It’s frequent to have some kind of control in parts of the processes, for instance when you want to send SMS to your customers. You certainly don’t want to do it at 03:00am.

How will we make this?

We should use a Catch Timer event, of course, and XPATH’s DateTime functions to check the current time and to set the timer to way for next morning’s 08:00.

The Catch Timer event has several ways to be configured (triggered at specific dates and times, on a specific schedule – every day at 10:28:00 (repeatable), or in a time cycle – every 2 minutes), but we’ll focus on the one where we configure the timer to wait for a specific time and date. More on the others perhaps in another article.

We’ll illustrate the use of timers with an example process. You can, of course, adapt it to your needs.

Defining the execution conditions 

So you start by defining a gateway that will split the execution between:

  • Immediate
  • Wait for 08:00am
    • This will have to be split into prior to midnight and after midnight. but for now, we’ll consider the scenario of only two options.

So, you set the expression on the conditional flow that will do the immediate execution, leaving the condition that must wait for 08:00 as the unconditional (default) branch.

The expression should be something like this:

Timer Setting

Timer Setting

xp20:hours-from-dateTime(xp20:current-dateTime()) >= 8  and xp20:hours-from-dateTime(xp20:current-dateTime()) <= 16

The function xp20:current-dateTime() gets the current Date and Time of when the decision is evaluated.

The function xp20:hours-from-dateTime(xs:dateTime) gets the ‘Hours’ integer from a dateTime object.

So you check if the current time is after 08:00am and before 04:00pm.

  • If it is, it follows the Green Light path, i.e. the immediate execution path.
  • If not, it will follow the Red Light path, and will wait on the timer for a green light (until 08:00am the next day, as per the requirements)

For the test process comprehension, check the process flow below.

Timer Test Process

Timer Test Process

So, only one more step to go: Setting the timer to the next 08:00am available.

This is achieved by setting the Timer implementation first to Type=Time Date (red arrow) and then setting the appropriate XPATH expression (orange arrow)

Timer Type Setting

Timer Type Setting

The XPATH expression is as follows:

xp20:add-dayTimeDuration-to-dateTime(xp20:current-date(),’P01DT08H’)

The add-dayTimeDuration-to-dateTime(xs:dateTime,formattingString) function adds an interval of date/time to a dateTime object.

The interval is set using the format ‘PyyYmmMddDThhHmmMssS‘.

The xp20:current-date() function returns the current date without the time associated, meaning it considers time = 00:00:00.

So, we’re stating that we want to add to the current date the amount of 01 day and 08 hours.

Warning

You would think that this solves the issue, but not quite. It solves the issue if the process reaches the decision point until midnight. After midnight, you can’t add a whole new day and then another 08 hours.

So you should split your flow further to handle these two scenarios:

  • Wait occurs prior to midnight => XPATH Expression interval = ‘P01DT08H’
  • Wait occurs after midnight => XPATH Expression interval = ‘P00DT08H”

I’m pretty sure there are other ways to do it, but I decided to do it like this:

Timer Process Final

Timer Process Final

In which I set the XPATH for Time Date type of the other Timer (Red Light / After Midnight) as

xp20:add-dayTimeDuration-to-dateTime(xp20:current-date(),’P00DT08H’)

So this should solve the case.

I added the project file for this:

CommunityTimerDefinition

Cheers

Maverick (José Rodrigues)

Post Header image by Henrique Simplicio

Manage your Travel Requests

Video – How to build a Process Cloud Service Application (Business Travel Requests) in 40 minutes – Part II – Process Form

Hi,

Welcome to Red Maverick’s fourth video, the second of the Business Travel Request Management Series.

In this series we’ll guide you on how to build a complete, working BPM application using  Oracle’s Process Cloud Service.

This second part is about designing the form that is the data foundation for your process.

In the next parts, you’ll see how to build advanced rules, conduct escalations and going up management chains.

This scenario and video was first prepared by me for Link Consulting‘s Process Cloud event, that was held in July 2015.

Enjoy!

Cheers

José Rodrigues, a.k.a Maverick

Post image by Mac Qin

Travel Request Application Demo

Video – How to build a Process Cloud Service Application (Business Travel Expense) in 40 minutes – Part I – Designing your process

Hi,

Welcome to Red Maverick’s third video.

In this one, we’ll guide you on how to build a complete, working BPM application using  Oracle’s Process Cloud Service.

The first part is about designing your process from a functional/business point of view

In the next parts, you’ll see how to setup a process start form, build advanced rules, conduct escalations and going up management chains.

This scenario and video was first prepared by me for Link Consulting‘s Process Cloud event, that was held in July 2015.

Enjoy!

Cheers

José Rodrigues, a.k.a Maverick

Post image by Paul Nelhams