Skip to content

Create sync properties that copy data across associated records

To have a change in a Deal field update another Contact field, the path is Development → Scripts: you write the code and hook it to the object’s lifecycle event. What follows describes the module as it appears in the app.

The Scripts table lists, for each one: Script (name), Active, Lifecycle hooks, Variables, Scheduled task, and Git.

Scripts table with columns Script, Active, Lifecycle hooks, Variables, Scheduled task and Git

When editing a script, the Lifecycle hooks field is a multi-select of system objects: a real script can have Company, Contact, and Deal selected at once. The helper text is explicit: “The script will run when the specified lifecycle event is triggered.” In other words, one script can react to changes on several objects and, inside its code, read a field from one and write it to another — that’s what makes syncing possible.

Edit Script form with Lifecycle hooks set to Company, Contact and Deal, and the note 'The script will run when the specified lifecycle event is triggered'

Besides lifecycle hooks, each script has:

  • Code (required) — a free-form JavaScript editor. A real script can use its own EventManager to register handlers by event name (Events.on('ApiRun', ...)), not only by object change.
  • Run on quote calculate — a toggle that, when on, runs the script once per Quote.calculate with the full quote.
  • Variables — script-specific variables, kept separate from the code.
  • Scheduled task — with its own periodicity, to run the script on a schedule instead of (or in addition to) by event.
  • Git — a linked repository (for example https://github.com/.../hook-oxohotel.git), to version the code outside Prolibu.

Frequently asked questions

Was this article helpful?