Forum Discussion

Mikki's avatar
Mikki
New Contributor III
2 hours ago
Solved

Throw error when Clear/Deleting file in WF Import using TR event handler

Hi,

I have been playing around with TransformationEventHandler and one of the things I am trying to do is throw an error when an user tries to clear imported/stage data. I think I got the code but I only want it to run on specific WF. I tried to use below but for some reason not able to retrieve the WF profile name. Any idea why?

Case Is = BREventOperationType.Transformation.ParseAndTrans.StartClearData
 
Dim ScenarioName As String = BRApi.Finance.Members.GetMember(si, dimType.Scenario.Id, si.WorkflowClusterPk.ScenarioKey).Name
 
If ScenarioName = "Forecast" Then
 
Dim objTransformer As Transformer = DirectCast(args.Inputs(0), Transformer)
If objTransformer.WorkflowProfile.Name.XFEqualsIgnoreCase("AAAAA.BBBBB") Then
 
Throw New XFException(si, Nothing, Nothing, "Data cannot be deleted.....")
End If
 
End If
  • You can use the following to get the WF info while in the TrasformationEventHandler:

    Dim WFInfo As WorkflowProfileInfo=BRApi.Workflow.Metadata.GetProfile(si,si.WorkflowClusterPk.ProfileKey)

     

2 Replies

  • rhankey's avatar
    rhankey
    Contributor III

    You can use the following to get the WF info while in the TrasformationEventHandler:

    Dim WFInfo As WorkflowProfileInfo=BRApi.Workflow.Metadata.GetProfile(si,si.WorkflowClusterPk.ProfileKey)