Copying an existing Unifi trigger rule doesn't work

If you're looking to integrate a new table with Unifi (prior to v3 as this is then done automatically), and you create a new trigger business rule for the new table from an existing Unifi trigger rule, be careful with what you copy! Old business rules use a different way to invoke the script from new ones!

Overwriting a new business rules invoke method with an old one will mean the business rule fails. Only copy the Unifi code inside the business rule invoke method.

Old business rule invoke:

function onBefore(current, previous) { 
  .... 
}

New business rule invoke method:

(function executeRule(current, previous /*null when async*/) { 
  .... 
})(current, previous);

Last updated