Forum Discussion

Marco's avatar
Marco
Contributor II
8 days 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 this change to modify a process that relies solely on the information from this attribute. Therefore, I would be grateful for your assistance.

  • 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

  • sameburn's avatar
    sameburn
    Contributor II

    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

  • Henning's avatar
    Henning
    Valued Contributor II

    Hi,  I believe profile keys should not be changed. I would try to find an attribute for your process that relies on a different metric.

     

    Edit: 

    I had a discussion with a sameburn and we are not sure how this question is meant exactly. I interpreted it as "I would like to change and set the profile key of an existing profile" - which is what I based my original answer on. But I do see now that my interpretation may have been wrong.

    If one wants to obtain a key to use it for a downstream process, that is not an issue (assuming the use case makes sense, but that applies really to everything). Please see sameburn's response for that. ğŸ™‚