You are reading the documentation for an outdated Corteza release. 2024.9 is the latest stable Corteza release.

Returning values

You can abort script execution by returning (return …​) at any point in the script. Returning false will cause abort and will prevent record create/update/delete in before* triggers.

You can always return the (changed) record you’re currently running the script for and cause that a modified (by your script) version of an object is then passed back to Compose. This can be used in beforeCreate and beforeUpdate triggers to save modified version or in manual triggers to change the current record on the fly (even without explicitly saving it in the script)

Modifying current $record and returning from automation script

Rules:
  • Critical scripts have to be executed successfully and return [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) value.

  • If automation scripts returns Record system will update current $record (if Module then $module, etc…​)

  • Modifications of $record (and other $*) and return values of async scripts are ignored

  • Modifications of $record (and other $) and return values of after triggers are ignored