Skip to main content

Lesson 9 · Events: letting the process move on its own

M
Written by Mairu

Path

Duration

Level

Before you start

🟣 Configurator · Level 2

60 min

Intermediate

Configurator · Level 1 path complete (lessons 3 to 8)

So far the Packaging control records information. With events it will start to act: it will alert Quality when something goes wrong, mark each control with its status and generate the next task. It is the step that turns a form into a process.

🎯 By the end you'll know how to

  • Create an event with its condition and its action.

  • Send an email and a notification with form data.

  • Update the status of a response.

  • Schedule another form inheriting information.

  • Know when events fire (and when they can fire without you expecting it).


🧠 The idea: on save, if this is met, do that

An event has the same structure as a rule, but it acts when the response is saved:

WHEN               Result is equal to NOT OK
THIS WILL HAPPEN   Send email to Quality

If you leave the condition empty, the event runs every time on save.

The available actions

Action

What for

Send email

Alert by email, to users, departments or an address stored in a field

Notify

Alert inside Mairu (bell on web and mobile)

Update status

Move the response to another phase of the process

Schedule form

Create a task of another form (or of the same one)

Load subform

Create responses in a subform, even from a query

Update stock

Add or subtract stock of a product

Webhook

Send or request data to another system (lesson 15)

Redirect / Save form

Take the user to another form or save from a button

💡 If you add a Button component as a condition (on click), the event runs when the button is pressed, without waiting for a save.

When do they fire?

Events are evaluated every time a response is created or modified, wherever it comes from: from the form (web or mobile), from the API, from an import, from a bulk edit or from another schedule or event that creates responses automatically.

⚠️ This is very important. If you import 200 historical controls and there is an event that sends an email when the control is NOT OK, one email will go out for each NOT OK control imported. Review the events before any bulk load.


🛠️ Guided practice

Open the Packaging control and go to the Events tab.

Event 1 · Automatically close OK controls

  • When: Result is equal to OK.

  • This will happen: Update status → Compliant.

Event 2 · Leave NOT OK ones pending review

  • When: Result is equal to NOT OK.

  • This will happen: Update status → Pending review.

Also add a Status selector component to the form: Quality will use it to close the control as Compliant or Non-compliant after reviewing it.

Event 3 · Email to the quality manager

  • When: Result is equal to NOT OK.

  • This will happen: Send email.

  • To: the user calidad.prueba (or the Quality department).

  • Subject (use { } to insert fields): Control NOT OK · {linea} · batch {lote}

  • Message (allows HTML):

<p>A packaging control has been recorded as <b>NOT OK</b>.</p>
<ul>
  <li>Line: {linea}</li>
  <li>Product: {producto}</li>
  <li>Batch: {lote}</li>
  <li>Reason: {motivo_rechazo}</li>
  <li>Corrective action: {accion_correctora}</li>
</ul>

Event 4 · Notification in Mairu

  • When: Result is equal to NOT OK.

  • This will happen: Notify the Quality department, with the title Control NOT OK on {linea}. If you like, use the Photo field as the notification image.

Event 5 · Schedule the verification of the corrective action

  1. Create a simple form, Corrective action verification, with: Line (Assets), Batch (text), Corrective action (long text), Is it effective? (single choice Yes/No) and Comments. Publish it under Quality > Packaging with permissions for Quality.

  2. The schedule is assigned to the connected user or to the user or department chosen in a form field. Add to the Packaging control a Department selector Verification manager (ID dpto_verificacion), with default value Quality and disabled.

  3. In the Packaging control create the event:

  • When: Result is equal to NOT OK.

  • This will happen: Schedule form → Corrective action verification.

  • Title: Verify batch {lote}.

  • Assignment: the dpto_verificacion field.

  • Asset: the linea field.

  • Start date: the creation date, +1 day.

  • Inherited fields: linea → Line, lote → Batch, accion_correctora → Corrective action.


🔍 Check that it works

As operario.prueba, save one OK control and one NOT OK control. Then:

  • The OK control appears in the history as Compliant; the NOT OK one, as Pending review.

  • calidad.prueba has received a single email, the one for the NOT OK, with the control data.

  • There is a notification in the bell of calidad.prueba.

  • In the Schedules tab of the Corrective action verification form there is a Verify batch … task that already comes with the line, the batch and the corrective action.


⚠️ Common mistakes

  • "Emails arrive for every control." The event has no condition, and without a condition it always runs.

  • "The email doesn't arrive." Check that the recipient has a valid email: if the value is not in email format, the message is not sent. Also check the spam folder.

  • "An avalanche of emails arrived." Someone did an import or a bulk edit on controls that met the condition.

  • Putting into an event what is actually a rule. If something must happen while the form is being filled in, it is a rule.

  • Alerting on every record instead of reviewing periodically. If the alert does not depend on someone saving, but on checking data every so often, what you need is an automation (lesson 12).


🏋️ Challenge

Quality also wants to be notified when the temperature exceeds the limit even if the operator marked OK. Set up the alert without duplicating emails: if the control is NOT OK and the temperature is also out of range, only one email should go out. Hint: think about the AND / OR conditions and how many events you need.


📚 Learn more

Did this answer your question?