Getting Started with Business Rules
Business Rules are the backbone of OneStream customization. They allow you to extend the platform with custom logic written in VB.NET, executed at specific points in the application lifecycle. Each Business Rule is an independent VB.NET class — it can be as simple as a one-line log message or as complex as a full code library with custom classes, methods, and properties.
What Are Business Rules?
A Business Rule is a block of code that OneStream executes in response to a specific event or action. Think of them as hooks into the platform — when something happens (a form loads, data is consolidated, a cube is calculated), your rule runs.
Types of Business Rules
OneStream organizes Business Rules into three categories based on their purpose and how they are triggered.
Finance Rules
Finance Business Rules execute during cube operations — calculations, translations, and consolidations. They are written as Shared Business Rules and applied to a Cube, or as Member Formulas on individual dimension members. The
api.FunctionType property tells you which operation triggered the rule, such as Calculate, Translate, ConsolidateShare, or DynamicCalcAccount.Most applications primarily use the
Calculate function type for stored calculations and DynamicCalcAccount for on-the-fly computed values. OneStream's built-in translation and consolidation algorithms handle the rest automatically in most cases.Dashboard Rules
Dashboard Business Rules power the UI layer. There are three sub-types:
- Dashboard DataSet — Returns datasets to dashboard components. Used for populating reports, combo boxes, list boxes, and other data-bound controls. Function types:
GetDataSetNamesandGetDataSet. - Dashboard Extender — Handles dashboard lifecycle events and user interactions. Function types:
LoadDashboard,ComponentSelectionChanged, andSqlTableEditorSaveData. - Dashboard String Function (XFBR) — Returns string values used in dashboard component parameters and expressions.
Extensibility Rules
Extensibility Rules extend the platform beyond standard cube operations:
- Extender — Facilitates custom automated tasks. One of only two rule types that can be called directly from a Data Management step. Common use cases include automating GL data imports, FTP file transfers, and custom dataset exports.
- Connector — Handles data integration, drill-back to source systems, and ETL processes. Actions include
GetFieldList,GetData, and drill-back operations. - Parser — Custom data parsing logic for transformation rules.
- CubeView Extender — Extends CubeView behavior with custom logic.
- Spreadsheet — Enables reading from and writing to database tables within the Spreadsheet tool. Can work with MarketPlace solution tables or custom tables.
Event Handler Rules
Event Handlers are unique — they are the only rule type that does not need to be called from another artifact. OneStream has a built-in Event Engine that listens for specific platform events and triggers your code automatically.
There are seven Event Handler types:
| Event Handler | Triggered By |
|---|---|
| Transformation | Import, validate, load Cube, and clear Stage data events |
| Journal | Journal submission, approval, posting, and rejection events |
| Data Quality | Workflow certify, lock, unlock, and data quality check events |
| Data Management | Data Management sequence step events |
| Forms | Form open, save, and validation events |
| Workflow | Workflow state changes (lock, unlock, certify, process) |
| WCF | Low-level service call events |
Within each Event Handler, you access specific sub-events using the
args.OperationName property and cast the args.Inputs to extract contextual information about the event:Basic Structure
Every Business Rule follows a similar pattern. The examples below show a Finance Business Rule — the most common type. Other rule types use different
api and args parameter types but follow the same overall structure.Here is a minimal Finance Business Rule:
The
api object is your gateway to the OneStream platform. It provides access to data, metadata, and utility functions.Full Rule Skeleton
The code shown in Basic Structure above is just the inner logic. In the OneStream Business Rule editor, every rule is wrapped in a full VB.NET class with Imports, a Namespace, and a
Main function. Here is the complete boilerplate for a Finance Business Rule:Key elements:
si(SessionInfo) — Contains information about the current user session.globals(BRGlobals) — A shared object that persists across Data Unit calculations within a single process (more on this below).api(FinanceRulesApi) — The context-specific API for the current calculation. The type varies by rule type (e.g.,DashboardDataSetArgsfor Dashboard DataSet rules).args(FinanceRulesArgs) — Contains arguments about what triggered the rule, includingFunctionType.ErrorHandler.LogWrite— The standard OneStream pattern for catching and re-throwing exceptions with proper logging.
Related Content
Now that you understand the basics, continue with these guides:
- Getting Started with Finance Rules — Deep dive into Finance Business Rules — function types, Data Units, calculation techniques, and the Finance Rules API
- Debugging Business Rules — The StringBuilder debug logging pattern and understanding rule error handling