Skip to main content

Decision trees

Decision tree logic

You can use decision trees to handle logic that returns a result from a set of test conditions. Decision trees can evaluate against different test conditions and properties. A true comparison can lead to additional comparisons.

For example, a human resources application contains a process for assessing a job candidate. The candidate receives a set of ratings during the interviews. These ratings are evaluated to determine whether to extend a job offer to the candidate. A decision tree is configured to automatically use the ratings as test conditions to decide whether the candidate is qualified. The decision starts at the top of the tree and proceeds downward. Each yes advances the evaluation. The result is either Not qualified or Eligible for job offer.

Decision tree example for extending a job offer

You can reference decision trees in flow rules, declare expressions, activities, or routers.

The following video describes the structure of a decision tree.

Video transcript

Like a decision table, a decision tree consists of a set of conditions to evaluate, and results to return. Unlike a decision table, however, a decision tree consists of a series of branches that contain more- and more-specific conditions, ultimately leading to a return value.

Condition branches

Decision trees contain condition branches — a comparison value, a comparison operator, and an action. The action can be to return a result, to continue the evaluation, or stop the evaluation. The branches are organized in a hierarchical tree structure. Typically, you specify common conditions and results at the trunk of the tree. You then extend the tree outward to more-specific conditions and their actions. When the decision tree is invoked, the system evaluates the top row and continues until it reaches a result that evaluates to true. The result is returned to the system. If the system processes through all the branches but does not reach a returned result, the system returns the final otherwise value.

decision tree configuration

Nested branches

You can organize decision tree branches in a nested structure. For example, assume that when a purchase request is submitted, three possible outcomes exist. The first condition states that if the request is for more than USD100, then the request must be routed for approval. Two possible approval results exist. If the Consulting department submits the request, the request advances to the Compliance department for approval. Otherwise, the request advances to the work manager for approval. If the request is for less than USD100, then approval is not needed.

The following image shows how the decision tree would be configured to advance the request correctly. Note that the department approval condition is nested beneath the purchase request condition. The purchase request condition must be true before the department approval condition is evaluated. If the request is for less than USD100, the tree does not need to evaluate the request any further and returns the result Not needed.

Decision tree for a purchase request

Check your knowledge with the following interaction.

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice