How to Trigger an Automation Rule from a Website Form

Automating actions when users submit forms on your website can save time and improve efficiency—whether you're capturing leads, creating tasks, or managing email subscriptions.

However, not all website forms trigger automation actions. For example, a standard newsletter form won’t trigger automation rules. Instead, you should use the Form Block​, which offers greater flexibility in field customization, default values, and triggers automation rules.

In this post, we’ll continue with our email sequences automation example from How to Create Fully Automated Email Sequences article, focusing on how to trigger an email sequence immediately after a user subscribes, eliminating the need for scheduled actions.

Step 1: Setting Up the Subscription Form

To ensure automation triggers work, we’ll configure a Form Block​ instead of a basic newsletter block. Here’s how:

  1. Go to your website editor and select the Form Block.
  2. Set the action to "Subscribe to Newsletter."
  3. Customize your form layout.
  4. Define the form fields (e.g., Name and Email), ensuring they are mapped to the correct model fields.
  5. Add the Mailing List​ selection field, if it’s not already included in the form:
    • Set the default value to the list you want (e.g., AI Course).
    • Hide the field if you don’t want users to view or change the list.
  6. Add a specific tag for subscribers from this form:
    1. Add a new field to the form.
    2. Map the field to the Tags​ field in the Mailing Contact​ model.
    3. Set the default tag to be applied on submission (e.g., AI Course).
    4. Hide the field if you don’t want users to modify it.

Now, when users submit this form, they’ll be added to the specified mailing list and tagged with the correct tag.

Step 2: Creating the Automation Rule

Next, we’ll set up an automation rule that triggers when a new subscriber is tagged.

  1. Create a new Automation Rule and set the model to Mail Contact​.

  2. Set the trigger to When a tag is added​ (use the same tag from the form, e.g., "AI Course").

  3. Add additional filters to target the right subscribers—for example, 
    Mailing List Name = AI Course​.

  4. Add two Execute Code​ actions:

  • The first action adds the subscriber to the email sequence:
env["marketing.campaign"].search([
('state', '=', 'running'), ('title', '=', 'AI Mini Course')
]).sync_participants()
  •     The second action triggers the flow instantly:
env["marketing.campaign"].search([
('state', '=', 'running'), ('title', '=', 'AI Mini Course')
]).execute_activities()


Final Thoughts

With this setup a new subscribers are automatically added to your email sequence and the first email is triggered immediately—no waiting for scheduled jobs.

By using Form Blocks​ and automation rules, you can streamline workflows and ensure instant responses to user actions.