Execute a Workflow multiple times with different periods from a BR
I am trying to automate a yearly load of data from a business rule. I want the rule to loop through a set of periods and run a specific workflow for that period. The workflow uses a connector rule in which I get the scenario and period of the workflow being run.
THe issue I am facing is that I can get the WorkflowPK for the workflow/scenario/time that I want to run. But when I call BRApi.Import.Process.ExecuteParseAndTransform with that key, a workflow starts, but if I happen to be on that workflow in the session I am running it picks up the POV from where I am at. So if I want my business rule to run 3 periods (Jan - Mar). If I am on Dec, then it runs December every time. Below us how I get the WFPK and call the
Dim wfClusterPk As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, wfProfileInfo.Name, wfScenarioName, wfTimeName)
'---------------------------------
' Parse and Transform:
'---------------------------------
Dim ImportInfo As New LoadTransformProcessInfo
ImportInfo = BRApi.Import.Process.ExecuteParseAndTransform(si, wfClusterPk, String.Empty, Nothing, TransformLoadMethodTypes.Replace, SourceDataOriginTypes.FromDirectConnection, False)
Here is my connector rule that gets the scenario and the time;
Dim wfPk As WorkflowUnitPk = BRApi.Workflow.General.GetWorkflowUnitPk(si)
Dim wfProfileInfo As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, wfPK.ProfileKey)
'Get the WF Time and WF Scenario from API
wfTime = brapi.Finance.Members.GetMemberName(si, dimtypeid.Time, si.WorkflowClusterPk.TimeKey)
wfScenario = ScenarioDimHelper.GetNameFromID(si, wfPk.ScenarioKey)
Dim objTimeMemberSubComponents As TimeMemberSubComponents = BRApi.Finance.Time.GetSubComponentsFromName(si, wfTime)
wfFiscalYr = objTimeMemberSubComponents.Year
wfFiscalPer = objTimeMemberSubComponents.Month
Any and all thoughts are appreciated.
Scott