Skip to main content
Member
Jan 19, 2026 7:35 PM UTC
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
rhankeyAnswer
Newcomer
Jan 19, 2026 8:05 PM UTC

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

rhankeyAnswer
Newcomer
Jan 19, 2026 8:05 PM UTC

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)

 

MikkiAuthor
Member
Jan 19, 2026 8:11 PM UTC

Thank you. Above worked.