Mikki
2 hours agoNew Contributor III
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)