The Finance Rules API
This guide covers the key API objects available inside Finance Business Rules — the context-specific
api object, the application-wide BRApi static class, and mechanisms for sharing code between rules.The Finance Rules API Object
The
api parameter passed to Finance Business Rules (FinanceRulesApi) exposes a rich set of properties for interacting with the current execution context:| Property | Type | Description |
|---|---|---|
api.FunctionType | FinanceFunctionType | The operation that triggered the rule |
api.Entity | EntityApi | Current entity being processed |
api.Scenario | ScenarioApi | Current scenario |
api.Time | TimeApi | Current time period |
api.View | ViewApi | Current view (Periodic, YTD, etc.) |
api.Account | AccountApi | Current account context |
api.Flow | FlowApi | Current flow member |
api.Cons | ConsApi | Consolidation context |
api.Data | DataApi | Read/write cube data |
api.Members | MembersApi | Access dimension members |
api.Dimensions | DimensionsApi | Access dimension metadata |
api.Cubes | CubesApi | Access cube definitions |
api.Pov | PovApi | Full Point of View context |
api.Workflow | WorkflowApi | Workflow context |
api.Functions | FunctionsApi | Utility and helper functions |
api.FxRates | FxRatesApi | Foreign exchange rate access |
api.CalcStatus | CalcStatusApi | Calculation status tracking |
api.Profiler | FinanceProfilerApi | Performance profiling |
api.UD1 – api.UD8 | UDApi | User-defined dimension members |
The BRApi Static Class
While the
api object is context-specific to each rule execution, BRApi is a static class available across all rule types. It provides application-wide services:| Property | Description |
|---|---|
BRApi.Finance | Finance engine access — data, dimensions, members, metadata, calculations |
BRApi.ErrorLog | Write messages and errors to the application error log |
BRApi.Database | Direct database access |
BRApi.Security | User and role information |
BRApi.Workflow | Workflow operations |
BRApi.State | Application state and shared variables between rules |
BRApi.Utilities | General utilities (file harvest, batch processing, etc.) |
BRApi.FileSystem | File system operations |
BRApi.Import | Data import operations |
BRApi.Forms | Forms API access |
BRApi.Journals | Journal entry operations |
BRApi.Dashboards | Dashboard operations |
BRApi.CubeViews | CubeView operations |
BRApi.DataQuality | Data quality and validation |
BRApi.TaskActivity | Task and activity tracking |
BRApi.Profiler | Performance profiling and diagnostics |
BRApi.Metrics | Metrics and monitoring |
BRGlobals
The
globals parameter is passed to every Business Rule's Main function. It provides a way to store and retrieve objects that persist in memory throughout a single calculation or consolidation process.This is useful when you need to perform an expensive operation (such as a SQL query or loading a large reference dataset) once and reuse the result across multiple Data Unit executions:
Sharing Code Across Rules
As your application grows, you'll want to avoid duplicating logic across multiple Business Rules. OneStream provides two mechanisms for code reuse.
ContainsGlobalFunctionsForFormulas
Every Business Rule has a ContainsGlobalFunctionsForFormulas property. When set to
True, any Public Function defined in that rule becomes available to Member Formulas and other rules throughout the application.This is the simplest way to create shared utility functions — write them in a dedicated Business Rule, enable the property, and call them from anywhere.
BR Referencing
For more structured code sharing, you can reference one Business Rule from another using the Referenced Assemblies property. Add a reference using the
BR\ prefix followed by the rule name:Referenced Assembly:
BR\SharedFinanceFunctionsThen instantiate and call the referenced rule's class:
Related Content
- Debugging Business Rules — The StringBuilder debug logging pattern and understanding rule error handling