A M2MRuleset can be extended by pre-process and post-process JSFunctions.
The pre-process JSFunction is executed by the M2M Engine at the beginning of the transformation, just before the MappingRules are applied.
The post-process JSFunction is executed by the M2M Engine at the end of the transformation, just after the MappingRules are applied.
The JSFunction used as pre-process or post-process must not have any arguments, and if it returns a Variable, it will not be used by the M2M Engine. These JSFunction must be linked to the M2MRuleset via the Dependencies preProcessRuleset and postProcessRuleset
To proceed, right-click on the M2MRuleset, and click on Add new | M2M | preProcessRuleset or Add new | M2M | postProcessRuleset:
After clicking, a dialog windows is displayed to select the JSFunction as pre-process or post-process:
Once the M2MRuleset is linked to its pre-process and post-process JSFunctions, it looks like below: