Forum Discussion
To capture the moment just before transformation rules are processed, this would be a rule type of TransformationEventHandler, so you would have to put your Extender Rule code into a TransformationEventHandler, where you filter on this particular condition:
If args.IsBeforeEvent _
AndAlso args.OperationName = BREventOperationType.Transformation.ParseAndTrans.ProcessTransformationRules Then
' -- do your stuff just before transformation rules are processed --
End If
However there are two items to be careful about:
- I would be very wary about dynamically updating Transformation rules on the fly (as the question suggests) from a BR that is triggered just before the transformation rules get processed. Remember this is a multi-user and multi-threaded environment. What if multiple users are performing loads at the same time, and the rule is running concurrently for different users each with different data?
- Note that some Marketplace solutions, such as Transaction Matching (TXM) put their own TransformationEventHandler into the application, so be sure you are not interfering with that if you are using the TXM solution.
ChrisLoran I assume that for every transformation, the transformation event handler business will be called.
How do i filter that it runs only for specific workflow profile ?
- ChrisLoran2 years agoValued Contributor
*looks like we were both typing an answer at the same time*
For every transformation process , yes the transformation event handler will be called, but not for every transformation (as in each data row).So the Transformation Event Handler may be run concurrently if multiple users are performing import processes.
To filter only specific workflow profile, you can get the name of the workflow profile using the Transformer class instance, which is supplied in args.Inputs(0).
Example below:
If args.IsBeforeEvent _ AndAlso args.OperationName = BREventOperationType.Transformation.ParseAndTrans.ProcessTransformationRules Then ' -- do your stuff just before transformation rules are processed -- Dim objTransformer As Transformer = DirectCast(args.Inputs(0), Transformer) brapi.ErrorLog.LogMessage(si, args.OperationName & ", ProfileName=" & objTransformer.WorkflowProfile.Name) End If
For filtering only certain workflows, it's better to test the Text property of a workflow profile , rather than hard-code the profile name into rules.
These answers are not an endorsement of dynamically modifying transformation rules on the fly.
Any updates to transformation rules, should be protected by being enclosed within a SyncLock statement to ensure multiple parallel threads do no try to perform updates at the same time. - OS_Pizza2 years agoContributor III
I was able to write that
Dim objTransformer As Transformer = DirectCast(args.Inputs(0), Transformer)
Brapi.ErrorLog.LogMessage(si,"objTransformer.WorkflowProfile.Name=" & objTransformer.WorkflowProfile.Name.ToString)
Related Content
- 11 months ago
- 10 months ago
- 4 months ago
- 10 months ago