Creating business functions

You use the data model editor to create business functions that encapsulate reusable logic. Business functions include both functions and actions.

Business functions are reusable blocks of logic that help you:

  • Encapsulate complex logic in a single, maintainable location.
  • Promote reusability across multiple decision artifacts.
  • Simplify maintenance by updating logic in one place.

After they are defined in a data model, business functions become available to all decision artifacts that reference that model, enabling consistent application of business logic throughout your decision service.

Understanding the difference between functions and actions

Business functions come in two distinct types: pure functions and actions. Both functions and actions are reusable elements that can be defined once and used across different contexts. While they share some similarities, such as having input parameters, a body, and a verbalization, they serve different purposes:

  • A function represents a computation. Its primary purpose is to produce and return a value that is based on its inputs.
  • An action represents an operation that performs changes or produces side effects. Instead of returning a value, it executes a set of instructions that impact the system or its data.

Defining business functions

Business functions are defined by using Business Function Language (BFL), which combines Rule language constructs with BFL-specific syntax. For complete syntax details, see Business Function Language.

Business functions can be implemented in two ways:

Expressions
Single expressions that return a value. For example, computations or method calls.
Blocks
Groups of instructions that provide more complex logic. For example, variable declarations, loops, or affectations.