Writing User Defined Function

User Defined Functions are useful to help organize and re-use scripts. The user functions are defined in “Function” MBT Triggers. There is no limit on the number of user functions you may define.

Below is an example of a user function:

testoptimal.com_img_userfunc.jpg

You can call the user function with $callFunc('funcName','params') where 'params' is a string in the format of http url params like p1=value1,p2=value2.

Inside the user function, you can access the input parameters with $getFuncParam('paramName'). For example $getFuncParam('p2') to retrieve parameter 'p2' which should return 'value2' in the above example.

If you have comma in the parameter value, you will need to encode “,” with “[comma]”.

User function may return a value by calling $setFuncReturn('returnValue').

User function may call another user function with $callFunc(…).

Print/export
QR Code
QR Code define_user_defined_function (generated for current page)