You are on page 1of 19

An Oracle While Paper

February 2017

ADVANCED MODE IN JOURNAL APPROVAL RULES


Disclaimer
Disclaimer The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a commitment to
deliver any material, code, or functionality, and should not be relied upon in making purchasing
decisions. The development, release, and timing of any features or functionality described for Oracles
products remains at the sole discretion of Oracle.

2
Table of Contents

What is Advanced mode ..4

Why is it Required ...4

Advanced Mode pattern Matching options .5

Steps to Configure Rules in Advanced Mode6

Select "Advance Mode" 6

Add Pattern ..7

Define Condition 7

Adding Child Collection .8

Using Advanced Pattern ..10

Validate, Save and Commit 11

Use cases .15

What You Need to Know About Advanced Mode Rules .19

3
What is Advanced mode

Advanced settings for rules let user work with features that provide advanced options based on Business
Rules users need. These include additional pattern matching options allowing user more control over
the child collection of a transaction like Journal lines.

Why is it required?

Advanced mode is used in cases where approvals should be routed based on aggregate or pattern of
certain values in a journal batch. These cases are usually not possible or cumbersome to achieve with
normal rule conditions.

When approval is routed based on Journal line attribute, each and every line is processed for a particular
journal, for large journals where there are lines of 500 or more, each and every line would be processed
which is performance hungry ; resulting in delay in approval processing or sometimes lead to time out
issues. In such cases advanced mode is used to route them based on pattern and thereby reducing
performance cost.

4
Advanced Mode Pattern Matching Options
There are four additional pattern matching options that are only available in advance mode:
for each case where

This is the default pattern matching option. A rule should fire each time there is a match (for all
matching cases).

Rule will be evaluated for all the lines and notification will be sent for all the lines satisfying the
condition.

This is similar to normal mode, where every line gets processed and the approval is routed.
Use cases related to Journals, generally does not require this pattern

there is a case where

This option selects one firing of the rule if there is at least one match. In this feature rule will be
evaluated until it finds a line satisfying the condition. As soon as it finds a line satisfying the
condition a notification will be sent for approval. If there is no line satisfying the condition, no
notification will be sent.

there is no case where

The value specifies that the rule fires once if there are no such matches.
The rule will be evaluated until it finds a line satisfying the condition. A notification will be send
only if there is no line satisfying the condition.

aggregation

Aggregation functionality is used when customer need to perform operations (like Sum, Count,
Maximum, Minimum, Average, Collection) on attributes of collection.

5
Steps to Configure Rules in Advanced Mode

This section provides details on defining rules in advanced mode and also an example explaining how to
convert rule in basic mode to advanced mode.

Select "Advanced Mode"

To show the advanced settings, Click "Show Advanced Settings" icon next to the rule name and then select
"Advanced Mode" checkbox.

6
Add Pattern
By default, one "is a" pattern will be added to the rule as soon as "Advanced Mode" is selected. The left side
of a pattern is a variable and the right side is a fact type or a fact path. By default, rule designer sets the
variable name equal to the fact type or path. Variable name is user specific an can be changed
The following figure shows a variable "JH" of type "JournalHeader".

Define Condition
Use the variable defined in above pattern to create a condition on which rules have to be based on. The
following figure shows Journal Header collection with condition where Journal with currency as USD and total
accounting debit is more than 5000.

7
Adding Child Collection
As Journals could have multiple Journal lines, lets see how to use various attributes of Journal lines in
advance mode.

1. Define a collection "Lists". This list will be populated with the matching child collection based on the
condition defined.
Select the value in the Fact Type first (right side of "is a") from the drop down list and then the Variable
name (left side of "is a") gets populated automatically, variable name can be edited to user desired value.

Lists is a mandatory pattern. It needs to be defined because in THEN part of the rule list builder [Supervisory,
JobLevel, Resource, Approval Group, Position] internally uses Lists collection.

a) Click on "Add Pattern" button to add other patterns.

b) Add Lists pattern as below. No need to define any conditions under this, as we just need this to
iterate patterns defined using collections or also to prepare the list builder.

2. Task is used whenever user wants to define approval rules based on human task payload or any other
children of Task. For Ex, Task.payload, Task.creator etc.

8
Note: Since List builder is used in Then part , List is List collection is mandotory , in case if supervisory
rule or any listbuilder that includes any children of Task as mentioned above, then Task is Task should
aslo be used

3. Add pattern for Journal line to add conditions based on line attributes. As rules need to be defined on
Journal line attributes, a corresponding pattern need to be defined.

The following figure shows a pattern on Journal line with "Line" variable of Journal line type and then using
Account type attribute of Journal line

9
Using Advanced Pattern
As Journal could contain multiple Journal lines, the next step is to define a pattern matching option
for the journal lines with account type as Expense. To do this, surround the journal line pattern with
the advanced pattern matching option.

10
Based on the business requirement, different options can be selected.

If ONLY one instance of Journal line == E (Expense) satisfies the requirement then select
"there is a case where"
If there should be NO instance of Journal line == E then select "there is no case where"
If ALL Journal lines should belong to account type is E then select "for each case where"
Select "Aggregate" to use various aggregation operations

Validate, Save and Commit

Validate and save, if there are no errors reported, commit the rule

11
12
The resulting rule in Advanced mode

13
The same conditions when defined in Normal mode

The advantage of defining the above rule in advanced mode is , if there is batch with multiple journals
and each journal has few hundreds of lines, the performance would be highly impacted if all the journal
lines for each journal have to be processed in normal mode and might lead to stack overflow or time out
errors.

Performance is higly improved using advanced mode resulting in approval flow without any errros.

14
USE CASES
Use case 1:

User wants to route the approval of a journal batch based on accout type of journal lines ,
If the journal batch has expnese journal lines then the approval should route to one approval group,
and if it has no expense journal lines in the batch then it should route to another approval group.

The below rule is defined to route the approvals to Approval group AG1 in case there is a expense
journal line in the journal batch.

15
Define another rule for the condition when there is no expense Journal lines in the batch to route to
approval group AG2

16
Use case 2:
Use the aggregate function in advance mode to get the sum of Journal lines with account type as
expense and define the rules based on the sum.

a) if sum of debit journal lines with account type as Expense > 1000

Result = send to approval group AG3

17
18
In the above use case, we want to sum all the Debit journal lines where account type is E

JournalLine.accountedDr isnt null is used in the conditions to make sure only the debit lines are
summed

Variable Total_dr aggregates the sum of all debit expense journal lines and then we use this value in the
condition.

In the above use case if in the list builder human task payload or any other children of Task. For Ex,
Task.payload, Task.creator etc. is used then Task is Task also needs to be used along with Lists is Lists

What You Need to Know About Advanced Mode Rules


There are some special cases to keep in mind when you work with Advanced Mode rules, including
the following:

When you work with aggregates, in actions, you do not see pattern variables. The pattern variables are
only shown for action lists when you use (for each) patterns. Thus, you cannot see pattern variables in
aggregate, "there is a case", or "there is no case patterns".
After you select Advanced Mode the Advanced Mode stays selected and inactive (gray), as long as
your rule uses advanced options such as advanced pattern matching. To deselect Advanced Mode you
must remove or undo the advanced mode features (sometimes it is easier to start over by creating a
non-advanced mode rule and then delete the advanced mode rule).

To deselect the advanced mode option:

1. Select the rule or Decision Table where you want to deselect Advanced Mode.
2. Click the Show Advanced Settings icon next to the rule
3. Consider the state of the rule:

o If you can simplify the rule to enable the Advanced Mode option (such that
the Advanced Mode icon changes from gray to enabled). Then simplify the rule and
when Advanced Mode is enabled, deselect Advanced Mode.

o If you can use Undo to undo the steps you used to create the Advanced Mode rule, to
get to a state where the rule is no longer in Advanced Mode, then use this technique to
simplify the rule.

o If you cannot simplify the rule, then delete the rule and re-create it.

19

You might also like