Decision trees in offline mode

Offline-enabled mobile apps support decision tree rules that help you calculate a value from a set of properties or conditions, which you can use to establish additional comparisons.By learning how decision trees work in offline-enabled apps, you can ensure that your app operates reliably.

Packaging

Pega Platform packages decision trees that are in your application's model into the app distributable files. If the model does not reference a decision tree, you can ensure that the decision tree is packaged by adding the decision tree to the list of offline-supported components in your offline configuration template.

Usecase scenarios

You can apply decision trees in the following scenarios for offline-enabled apps:

  • Referencing a decision tree in a flow rule, as a type of decision shape
  • Calling a decision tree from a declare expression rule

Apart from standard scenarios, you can call decision trees with custom code. For example, the following scenarios represent custom use cases that are not readily available for offline-enabled apps:

  • Calling a decision tree from a collection rule
  • Evaluating a decision tree in an activity, with the Property-Map-DecisionTree method
To run custom scenarios, you can call decision trees with the pega.process.decisiontree.evaluate()JavaScript method. For example, you can define a variable in JavaScript code:
var result = pega.process.decisiontree.evaluate("OJMBRV-MyApp-Work-DecTreeCase","MyDecisionTreea")

Supported configuration of decision trees

Offline-enabled apps support the following configuration of decision tree rules:
  • Nested if conditions
  • Expressions
  • Call decisions: call Decision Tree, call Decision Table
  • Additional return action: setPropertyValue
  • The evaluate property option, with the exception of the evaluate action
  • Saving the result of a decision tree evaluation as a property
You can use the following conditions to design the logic of a decision tree:
  • [first value] [relation] [second value]
  • [first string] equals [second string]
  • [first string] does not equal [second string]
  • [string to search on] contains [string to search for]
  • [first String] [relation] [Second String]
  • [first number] [relation] [second number]
  • [First DateTime] [relation] [Second DateTime]
  • [a datetime] is in the [past/future]
  • created within the last [num] days
  • the work object is Resolved
  • the work object's status is [given value]
  • the customer satisfaction status is [given value]
  • [Pagelist Name] contains a page where [Property Name] equals [Value]
  • length of [a pagelist property] is [comparison operator] value
  • [expression evaluates to true]
  • rule [When record evaluates] to true
For decision trees in offline-enabled apps, you can use single-value properties on the following system pages:
  • Data-Admin-Operator-AccessGroup for AccessGroup
  • Data-Admin-Operator-ID for OperatorID
  • Data-Admin-Organization for Org
  • Data-Admin-OrgDivision for OrgDivision
  • Code-Pega-Process for pxProcess
  • Code-Pega-Thread for pxThread
  • Code-Pega-Requestor for pxRequestor
  • Rule-Application for Application

You can also use all utility functions and libraries that are supported in offline mode. For more information, see Function rules in offline mode.

Unsupported configuration of decision trees

Offline-enabled apps do not support the following configuration options of decision trees:
  • Additional return actions: AddSimpleAudit, GuardrailMessage
  • The evaluate action from the evaluate property option
  • Call decision: call Map Value
  • Results configuration options: Results defined by property, Additional Allowed Results, Preset Values
  • Calls to another decision tree with the CALL keyword