External methods in a formula
In the Workflow Manager, an external method can be linked to a business object's event handler. The external method then executes when the event occurs, such as when a record is loaded.
The Formula Editor provides a method called CallExternalMethod
. It is under the > node in the tree.
ServerApplication.CallExternalMethod (System.String assembly, System.String cls, System.String method, System.Object[] args)
Use this method to call external methods from your Infor Operations and Regulations formulas. It takes these parameters:
- assembly: Directory path to the assembly containing the method.
- cls: Class of the method.
- method: Name of the method.
- args: Optional parameter that sends a list of arguments to the external method.
This example shows an asset inspection index rating formula that calls a method called PMSCalculateAverageIndex
in an external class called InforPMSUtilities
. The external method is sent one argument, the inspection, and the IndexRating is then set to the value returned by the external method.
dim res as result
dim ExtDLL as string = ServerApplication.Path +
"Enhancement\bin\InforAgencyPavementUtilities.dll"
dim ExtClass as string = "InforClient.AgencyPMS.InforPMSUtilities"
dim ExtMethod as string = "PMSCalculateAverageIndex"
IndexRating = ServerApplication.CallExternalMethod(ExtDLL, ExtClass,
ExtMethod, CInt(InspKey))
ServerApplication.Path
property is used to get the first part of the path to the external assembly. Otherwise, you would need to hard code the full path to the Infor Operations and Regulations application directory. Also, unlike most other methods, CallExternalMethod
does not return a result. This means that all errors must be handled by the external method.