Workflow Substitution Variables
OneStream provides substitution variables that resolve to the current workflow context at runtime. These variables let you write generic Business Rules, Transformation Rules, and Dashboard expressions that automatically adapt based on which Workflow Profile, Scenario, and Time period the user (or batch process) is operating in. Instead of hard-coding dimension member names into your rules, you reference the workflow variable and let the engine fill in the correct value.
Variable Reference
| Variable | Resolves To | Example Value |
|---|---|---|
| WF | Full workflow context string (Scenario/Time/Entity) | Actual/2024M6/US_East |
| WFProfile | Name of the current Workflow Profile | Revenue_Import |
| WFProfileIndex | Index of the current profile in the hierarchy | 3 |
| WFScenario | Name of the current Scenario member | Actual |
| WFTime | Name of the current Time member | 2024M6 |
| WFCube | Name of the current Cube | MainCube |
All variables are retrieved through the same API call —
BRApi.Workflow.General.GetWorkflowSubstitutionVariable(si, "VariableName"). The string you pass must match the variable name exactly (case-sensitive).Using Variables in Business Rules
The most common use case is branching logic based on the current Scenario or Time. Rather than duplicating a Business Rule for each Scenario, you write one rule and let the substitution variable drive the behavior.
Using Variables in Transformation Rules
Transformation Rules run during the IVL (Import, Validate, Load) pipeline and have full access to workflow substitution variables. A common pattern is routing data to different accounts based on the Scenario — for example, mapping a source "Revenue" line to
A#GLRevenue for Actual but to A#PlanRevenue for Budget.The variables are resolved before the transformation expression is evaluated, so you can use them directly in conditional mapping expressions. If a Transformation Rule needs to apply different account mappings depending on whether the load is for Actual or Forecast, it reads
WFScenario and branches accordingly — one rule handles every scenario.Using Variables in Dashboard Expressions
Dashboard parameters and XFBR string functions can reference workflow variables to build context-aware displays. Two common patterns:
- Dynamic labels — Display the active context in report headers (e.g., "Revenue Report — Actual 2024M6") by reading
WFScenarioandWFTimeand concatenating them into a label string. - Data Adapter filtering — Pass
WFScenarioorWFTimeinto a Data Adapter expression so the grid or chart automatically filters to the user's current workflow context without requiring manual parameter selection.
Conditional Logic Based on WFScenario
A practical pattern is using
WFScenario in a Select Case / switch block to apply entirely different calculation models per scenario. This keeps all logic in a single Business Rule while still allowing each scenario to have its own formula.Related Content
- Workflow Engine Overview — architecture and core concepts
- Getting Started with Business Rules — foundational patterns for writing rules
- Workflow Status and Locking — querying workflow state programmatically
- Confirmation and Certification — the certification pipeline