Categories
#Business rules #Time in DCR Process Models

Deadlines and delays in business rules

In business processes you often need to express a deadline, e.g. the customer must have a reply within a week. Sometimes you face delays, e.g. you must wait 4 days before you can take a new corona test.

The Condition and Response rules supports delays and deadlines expressed as ISO 8601 Durations, e.g. P1W meaning 1 week or P4D meaning 4 days.

The Condition between Start and Activity 1 says that Activity 1 can be executed when Start has been executed and 1 day has passed.

In the model below we have modelled a Delay of 4 days after , P4D, the and a deadline of one week, P7D. When the Start activity happens a deadline will be set on the Deadline activity and a delay will be added to the Delay activity, meaning it is not enabled until 4 days has passed.

Duration expressions

On the condition, pre-condition and response rules you can enter a delay for condition/pre-condition or deadline for responses in the options panel as illustrated below.

A delay or duration is an expression that is based on the ISO 8601 duration format described below.

When writing duration expressions for delays or deadlines you can use the edit icon to the right of the “Enter Delay” above in order to get help writing duration expressions. The delay/deadline is copied to the Expression below

and the result of the expression is calculated based on the current time. In this way you can experiment writing expressions. P1D means one day ahead, while P1Y means one year ahead:

Clicking More

ISO 8601 Durations

DCR leverages ISO 8601 as a standard for expressing durations.

A duration of 5 days, 3 hours, 4 minutes and 2 seconds can be specified as outlined below.

ISO 8601 Duration
P5DT3H4M2S

Swimlane Editor – Duration

In DCR Swimlane Editor you can add a duration between two activities. For details about editing scenrios in swimlane editor read more here.

When adding a duration between activities in the Swimlane Editor simply drag the clock from to top to the swimlane. Once done a duration dialogue will be shown as illustrated below:

The Duration (delta attribute) is the actual duration between the activities and will be verified against the semantics of the DCR Process Model.

Durtion From, Duration To and Description (durationFrom, durationTo, and description attributes) are currenty for documentation purpose only. We might later add logic that can add the corresponding delays and deadlines in the DCR Process Model based on theese definitions.

These values are part of the DCR XML Log definition of the swimlane.

Entering the following values as an example

will provide the following DCR XML Log.

<advance delta=”P1D” description=”This is a text” durationTo=”P1DT20H7M” durationFrom=”PT20H” />

ISO 8601 duration picker

Any duration must be entered in an ISO 8601 duration format. In order to make it easier an ISO 8601 duration picker has been added to assist users entering correct ISO 8601 format for the most used time values.

Initial delay and deadlines

If an activity is marked as executed or pending it can also be assigned an initial delay and initial deadline respectively.

If you mark an activiy, e.g. “Initial delay”, as executed and set the initial execution time to 1 day ago, “P-1D” in ISO 8601 duration syntax.

Set the initial deadline for the inital deadline activity to 3 days, “P3D”.

When you start the simulation you will notice an initial delay and deadline:

Simulation with time

When process models contains delays or deadlines you must choose to simulate with time.

The above model is started on February 18th, 2021 at noon:

Once you execute Start you will notice that a deadline is added to the Deadline activity.

If you look in the Time area in DCR Simulation you will notice that a Delay exits:

If you advance time 4 days you will see that the time is not the 22nd of February and the task list now has the Delay activity enabled:

The definition of a time unit is up to the system using DCR to define. We assume that a time unit of 1 day or 1 hour would make sense in many situations.

Examples

You can play with examples of delay and deadlines in models given the examples below:

  • Decision Modelling in Timed Dynamic Condition Response Graphs with Data
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days This example is presented in the article Decision Modelling in Timed Dynamic Condition Response Graphs with Data presented at the DECH2 workshop associated with the BPM 2021 conference in Rome. A classical […]
  • An activity must happen once monthly on the 1st
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days Whenever a new month occur you need a specific activity to happen, “Do The Monthly Work”. Initially you need to start the process. This is done by executing “A: Start process”. This […]
  • Repeat an activity every week
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days
  • Set a deadline based on a duration
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days A deadline can be set based on data. You can enter a deadline as a duration and get a deadline for that specific date. The deadline expression Duration gives you the deadline. […]
  • Set a deadline based on a date
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days A deadline can be set based on data. You can enter a deadline as a date and get a deadline for that specific date. The deadline expression (DeadlineDate – now) + P7D […]
  • Start an activity when a child reaches a certain age
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days Working with Syddjurs Municipality we’ve seen examples where certain activities must start when a child reaches the age of 16 or 18. This model outlines how a delay is set so a robotic event […]
  • Put a deadline on hold in building case permits
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days We’ve worked with Genoa and Copenhagen Municipalities on building permit process and have found a pattern where a deadline is put on hold while awaiting information from the applicant. Below we outline […]
  • Absolute time – pattern for exception handling
    • Table of Contents Duration expressionsISO 8601 DurationsSwimlane Editor – DurationISO 8601 duration pickerInitial delay and deadlinesSimulation with timeExamplesA typical time patternSupporting working days This pattern is used to handle missing deadlines. Let us assume we have a deadline of 7 days for some Important Work to be done. We would like to model that after […]

A typical time pattern

Time will typically be used in a pattern where there is a deadline for an activity, expressed as time on a response rule. If this deadline is not met, an exception activity will occur. 

Time pattern

If the “must do event” is not completed before 4 time ticks the “Escalate” event will occur as it has the “Automatic” user assigned and is pending. Therefore the Lazy user should execute this event which will (a) exclude the “must do event” and (2) include the “handle escalation” event.

Supporting working days

Different countries have different working days. In order to support this the engine can be extended with a special DLL which calculates the number of working days. For more information please consult the API documentation for TimeManager class.

Related Release notes

Release 6.5

  • Improve your DCR skills through online exercises
  • Welcome to decision model and notation
  • Welcome to a more beautiful and faster DCR Portal

Related Videos

How to use Time in DCR Process Models

Related Articles

LinkedIn
Share