Forum Discussion

Marco's avatar
Marco
Contributor II
2 months ago

How to Obtain the ProfileKey and Modify This Attribute in the WorkflowClusterPk

Hi Everyone. What I want to do is change the value of: si.WorkflowClusterPk.ProfileKey What I want to change is the ProfileKey of a Profile that can obtain the value by name. I need to make...
  • sameburn's avatar
    2 months ago

    Hi Marco 

    Your requirement is a little ambiguous.   If your question is how can I generate the WorkflowUnitClusterPk object without relying on SessionInfo e.g. 

     

    si.WorkflowClusterPk.ProfileKey

     

    Then there is a way you can create the same object for Workflows that you are not logged into by passing in the Workflow Profile (Step) Name, Scenario Name and Time Name.  This enables you to interact with the WorkflowUnitClusterPk from a Workflow you are not logged into in OnePlace.  An example might be to retrieve the WorkflowProfileInfo object.  Please see example syntax below (variables hard-coded for reference. This is not recommended in practice).

    	' Declare variables			
    	Dim wfProfile As String = "Houston.Import"
    	Dim wfScenario As String = "Actual"
    	Dim wfTime As String = "2023M6"
    	
    	' Derive WorkflowUnitClusterPk
    	Dim wfClusterPK As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, wfProfile, wfScenario, wfTime)	
    	
    	' Declare WorkflowProfileInfo
    	Dim wfInfo As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, wfClusterPK)	

    Hope this helps

    Sam