Skip to main content
Member
July 7, 2026
Question

Get the name of the workflow for which you want to load data

  • July 7, 2026
  • 2 replies
  • 20 views

Hello everyone,

 

We currently have a data import from Oracle that retrieves data from the active workflow entity.

We would like to be able to schedule an import via the OneStream calendar for all of our companies; however, the data retrieved from Oracle always corresponds to that of the active workflow entity.

 

Example: 
Import workflows selected in the calendar: E10, E11, E12…
Import workflow names: E10_Import_Oracle / E11_Import_Oracle / E12_Import_Oracle
Workflow displayed to the user: E10

 

During the import, the stages of these three workflows all contain data from E10, which causes the transformation rules for E11 and E12 to fail, but not for E10.

 

How can I retrieve the name of each workflow being used for the import so that the script can send the entity code to Oracle via the API?
During the E10_Import_Oracle load: API script = requests data from entity E10
During the E11_Import_Oracle load: API script = requests data from entity E11

Thank you for your help

2 replies

Member
July 8, 2026

Hi,

Could you write or paste a snippet of the code showing how you're calling this import?

RobbSalzmann
Legend
July 8, 2026

Here is an Extender business rule that lists all entity assignments for the currently selected workflow.  There are two functions that do this. One lists the entity names for the currently selected workflow and the other lists the entity names for a supplied workflow profile name.

Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.Common
Imports System.Globalization
Imports System.IO
Imports System.Linq
Imports Microsoft.VisualBasic
Imports OneStream.Finance.Database
Imports OneStream.Finance.Engine
Imports OneStream.Shared.Common
Imports OneStream.Shared.Database
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Wcf
Imports OneStream.Stage.Database
Imports OneStream.Stage.Engine
Imports Newtonsoft.Json

'==============================================================================
' Returns the entity member names assigned to a workflow profile, resolved
' from the current session's WorkflowClusterPk or from a caller-supplied
' profile name. Both paths funnel into one key-based lookup against
' BRApi.Workflow.Metadata.GetProfileEntities. Run as an extender, it logs the
' executing session's workflow profile, scenario, time, and entity list.
'
' Author: Robb Salzmann
'==============================================================================
Namespace OneStream.BusinessRule.Extender.WFEntityParser
Public Class MainClass
Public Function Main(si As SessionInfo, globals As BRGlobals, api As Object, args As ExtenderArgs) As Object
Try
LogWorkflowProfileEntities(si)
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function

Private Function GetEntityNamesForWorkflowProfile(si As SessionInfo, workflowProfileKey As Guid) As List(Of String)
Dim profileEntities As List(Of WorkflowProfileEntityInfo) = BRApi.Workflow.Metadata.GetProfileEntities(si, workflowProfileKey)
If profileEntities Is Nothing Then
Return New List(Of String)
End If
Return profileEntities.Select(Function(profileEntity) profileEntity.EntityName).ToList()
End Function

Public Function GetEntityNamesForCurrentWorkflowProfile(si As SessionInfo) As List(Of String)
Dim workflowProfile As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk)
Return GetEntityNamesForWorkflowProfile(si, workflowProfile.ProfileKey)
End Function

Public Function GetEntityNamesForWorkflowProfileName(si As SessionInfo, workflowProfileName As String) As List(Of String)
Dim workflowProfile As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, workflowProfileName)
If workflowProfile Is Nothing Then
Return New List(Of String)
End If
Return GetEntityNamesForWorkflowProfile(si, workflowProfile.ProfileKey)
End Function

Private Sub LogWorkflowProfileEntities(si As SessionInfo)
Dim workflowProfile As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk)
Dim scenarioName As String = ScenarioDimHelper.GetNameFromID(si, si.WorkflowClusterPk.ScenarioKey)
Dim timeName As String = BRApi.Finance.Time.GetNameFromId(si, si.WorkflowClusterPk.TimeKey)
BRApi.ErrorLog.LogMessage(si, $"WorkflowContextDiagnostic: profile={workflowProfile.Name}, scenario={scenarioName}, time={timeName}")
Dim entityNames As List(Of String) = GetEntityNamesForWorkflowProfile(si, workflowProfile.ProfileKey)
Dim entityNameList As String = JsonConvert.SerializeObject(entityNames, Formatting.Indented)
BRApi.ErrorLog.LogMessage(si, $"WorkflowContextDiagnostic: {entityNames.Count} entity assignment(s) on {workflowProfile.Name}: {entityNameList}" )
End Sub
End Class
End Namespace