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
  • 9 replies
  • 113 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

9 replies

Member
July 8, 2026

Hi,

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

Member
July 9, 2026

Hello MichalWZ_pwc,

Here is the script that retrieves the entity name, which is then sent to Oracle to retrieve its account balance.

Dim accountDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si, "Corp_Entity")
Dim memFilterAccounts As List(Of MemberInfo) = BRAPi.Finance.Members.GetMembersUsingFilter(si, accountDimPk, "E#Root.WFProfileEntities", True)
Dim entities As New List(Of String)
For Each account As MemberInfo In memFilterAccounts
entities.Add(account.Member.Name)
Next

 

This script is run by all entities via their [Name entity].[Name import] workflow: E10.import_Oracle

The problem is that if I schedule the E10.import_Oracle workflow to run from the Task Scheduler and I’m currently on another entity’s workflow (e.g., E12), the script will run on that entity, sending a query to Oracle for the E12 ledgers, even though it’s the E10.import_Oracle workflow that’s launching the script.

So my idea is to be able to retrieve the workflow name from its “General” section (E10.import_Oracle, E11.import_Oracle...) rather than the name of the entity currently displayed in the user’s workflow.

But is this possible?

In my Business Rules, I found a script that retrieves this information via a TransformationEventHandler, but I’m not sure if it’s possible to adapt it, as my knowledge of VB.NET is limited.

Here is the script :
 

Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As TransformationEventHandlerArgs) As Object
Try
Dim returnValue As Object = args.DefaultReturnValue
args.UseReturnValueFromBusinessRule = False
args.Cancel = FalseSelect Case args.OperationName
Case Is = BREventOperationType.Transformation.ParseAndTrans.FinalizeParseAndTransform
If Not args.IsBeforeEvent Then
'retrieve information from the Transformer
Dim objTransformer As Transformer = DirectCast(args.Inputs(0), Transformer)
Dim strTempFileFullPath As String = DirectCast(args.Inputs(1), String)
Dim objLoadMethodTypes As TransformLoadMethodTypes = DirectCast(args.Inputs(2), TransformLoadMethodTypes)
Dim objGuid As Guid = DirectCast(args.Inputs(3), Guid)

If objTransformer.WorkflowProfile.CubeName = "GESTION" AndAlso objTransformer.WorkflowProfile.GetAttributeValue(ScenarioTypeId.Control, SharedConstants.WorkflowProfileAttributeIndexes.Text1).Contains("autoImport=True") Then

Dim profileKey As Guid = New Guid()
Dim tgtProfileName As String = objTransformer.WorkflowProfile.Name.Replace(".","_Conso.")

Thanks for your help

RobbSalzmann
Advisor
Advisor
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

 

Member
July 9, 2026

Hello RobbSalzmann
 

Thanks for your help.

Unfortunately, the script only returns the entity currently selected in my POV, not the entity that triggers the workflow via the Task Scheduler :(

Member
July 9, 2026

I also note that the time period in question is the user's workflow, not the one specified in the task scheduler, which therefore poses a major problem

 

Dim cAccountingPeriod As String = BRApi.Finance.Time.GetNameFromId(si, si.WorkflowClusterPk.TimeKey)

In the task scheduler's Business Rules, I can see the correct workflow and the correct time period for triggering the batch.

Perhaps it's possible to modify the import code to check whether a batch exists that triggered the import and to retrieve the values (entity and time) from it.

Contributor
July 9, 2026

It sounds like the connector BR is getting the wrong context. The list of entities should be something like:
Dim profileEntityInfo = New List(Of WorkflowProfileEntityInfo)(BRApi.Workflow.Metadata.GetProfileEntities(si, api.WorkflowProfile.ProfileKey))

Member
July 10, 2026

Thank you db_pdxdb_pdx

I updated the entity and period scripts to use the ones from the active workflow : 
 

Dim assignedEntities As List(Of WorkflowProfileEntityInfo) = BRAPi.Workflow.Metadata.GetProfileEntities(si, api.WorkflowProfile.profilekey)

Dim cAccountingPeriod As String = BRApi.Finance.Time.GetNameFromId(si, api.WorkflowUnitPk.TimeKey)

Data retrieval works perfectly with the correct entity and time period; however, if my POV is set to a different time period than the one used for the import, I get the error:
“No valid DataKeys (Scenario / Time) found in data source. Review the source data load processing log and check one-to-one transformation rules to ensure that you have created proper Scenario and Time dimension rules for this data source.”  right at the import stage, and no data is imported into the staging area.

I'll keep looking into it, but if you have any ideas, please let me know.

Contributor
July 10, 2026

You will still need to go from the List(Of WorkflowProfileEntityInfo) to an actual entity name.  I’ll also suggest you write the final query to the log so you can see the full script. That should hopefully help identify where it is going wrong.