Skip to main content

Hooks types

Common: reusable logic Import: Allows to import excel files Send Notification (web) Scheduled Jobs Generate QR Code

Send Emails

  • From: Email address from where you want to send the email, It is not required if was configured in the application designer
  • To: Email address of the destination person
  • Subject: Subject of the email (text plain)
  • Message: The body of the email can be in HTML format or Text Plain.
To know more about the allowed email options please read nodemailer docs

Documentation for Sending Emails with Base64 Attachments (backend, hooks)

Override email provider settings

If you want to use a different mail provider you can pass that configuration as a second parameter of the sendEmail function

Async Logic

Querying and importing database model

To see more querying examples you can use any sequelize method: https://sequelize.org/v4/manual/tutorial/querying.html

Hooks Errors

This section will show you how to throw hook errors. The simplest way to throw an error looks like this

🔁Redirecting to a different Feature

If you want to allow the user to see a modal with a button that redirects to a new Feature, you should throw an exception using the CodenullError class with the following parameters: ✅ Example:
💡 type: "navigation" is mandatory to trigger the redirect behavior. The params array allows dynamic values to be passed to the destination feature
This is how the error message will look, once the user hit the “Aceptar/Ok” button will be redirected to the new feature
This requires the 1.1.9 version or greater

Executing Store Procedure from Hooks

You can know more about queries here https://sequelize.org/master/manual/raw-queries.html

Other Import examples

Troubleshooting

  • Timeout doing database operations on the afterSave or any other after hook
Solution: Add the transaction to the operation as the second parameter