Skip to content

Automations

Extend automations

What package modules bring to automations without any extra work, how the AI Assistant builds and checks automations, and the interfaces and endpoints for new triggers and steps.

For
AdminsDevelopers
Time
6 min

Automations are not tied to the modules nexxus ships with. A package module you install adds its data and its actions, the AI Assistant builds automations in a conversation, and the triggers and steps themselves are a list that grows.

A package does not have to do anything for automations. Once it is installed and active:

  • Its entities are data sources. Each one appears in the list of sources with the key <package>:<entity>, with its indexed fields, the same way as in dashboard tiles and the AI Assistant. A field without an index is missing there too. Details in Sources from packages.
  • Its records trigger. A record is created and A record is changed work for package records, including Only on changes to: the package runtime reports which fields changed. Records that arrive through an import do not trigger, the same as everywhere else.
  • Its writing actions are steps. Run an action lists them next to the core actions, with the fields the package declares. Actions that delete or remove something are left out here too.

A change made by a package action can trigger other automations, within the same limits for chains.

A package cannot add a trigger or a step of its own. Triggers and steps are part of the nexxus platform, see New triggers and steps.

Describe what you want in the chat, for example “tell me when a risk becomes high”, and the AI Assistant can build the automation for you:

  • It proposes, you approve. Creating or changing an automation is a change like any other, so you see it first and confirm it. See The AI Assistant proposes, you approve.
  • It can try an automation out, with the same test run as the tab Test run, and see what would fail.
  • It can read the history of an automation, to find out why it did not run or which step failed.
  • It knows what the editor offers you: the triggers and steps, your sources with their fields, the actions a step can run and the limits. It reads them with the tool nx_automation_catalogue, from the same place as the editor.

The AI Assistant works with your rights. Tenant automations need the permission automation.manage here too, and a personal automation it creates belongs to you.

Triggers and steps are each a list of Spring beans in the nexxus backend. The check on saving, the runs and the test run work from that list, so a new trigger or step needs no change to any of them. The interfaces are in app.modules.automation, file AutomationTypes.kt:

InterfaceForMust provide
AutomationTriggerTypeevery triggerits key, label and description, whether it delivers records, normalise to check it on saving, describe for the sentence in the editor
AutomationEventTriggera trigger that reacts to changes of recordsfires: the run a change starts, or none
AutomationPollingTriggera trigger that checks by itselfdue and poll. The job AUTOMATIONS asks every minute
AutomationStepTypeevery stepkey, label, description, normalise, describe and execute; needsRecord and childKeys for steps like If / else

A few rules hold for every type:

  • normalise keeps only the fields that belong to the type and throws BxBadArgumentErr with a sentence for the person in the editor.
  • execute runs as the person the automation runs as, inside the transaction of the run, so a failure rolls back the whole run. In a test run (ctx.test) it changes nothing and returns what it would do as preview.
  • What execute returns as output is available to later steps as {{stepN.<field>}}.

The editor has forms for the built-in types only. A trigger or step without a form shows its label from /api/automation/types and a notice such as A module brings this step; here it can only be moved or removed. Its settings stay as they are; it is set up through the actions below.

The editor reads four endpoints. Each answers with the rights of the person signed in:

EndpointReturns
GET /api/automation/typesevery trigger and step with key, label and description
GET /api/automation/sourcesthe sources you may read, with their fields and the comparisons each field supports
GET /api/automation/actionsthe writing actions you may run as a step, with their input schema
GET /api/automation/statuswhether the two cron jobs run, and whether you may manage tenant automations

Automations themselves are created, changed and tried out through the actions automation.create, automation.update and automation.test, and automation.runs returns their history. The AI Assistant uses the same actions, and reads what the four endpoints return through the tool nx_automation_catalogue.