# Create an automation

> Build an automation from a blank canvas, choose its trigger, add actions such as Send Email, and save it.
>
> Source: https://docs.bcl.my/create-automation/

Build an automation yourself when no template is close to what you need. You name it, choose the event that starts it, and add the actions for BCL to run. In this example, Kopi Kampung emails its sales team every time a customer sends the wholesale enquiry form.

To start from a ready-made workflow instead, see [Start an automation from a template](/automation-templates/).

## Name the automation

Start with a name, so you can find the automation later.

1. In the sidebar, click **Automations**, then click **New Automation**.

   *(Screenshot: The New Automation button on the Automations page)*

2. Type a **Name** that says what it does, then click **Create**.

   *(Screenshot: The Create New Automation dialog with the Name field filled in)*

BCL opens the **Edit Workflow** page with an empty canvas.

> **Note**
> BCL turns on a new automation as soon as you create it. It does nothing until it has a trigger and an action. To finish it later, click **Deactivate** to turn it off.

## Choose the trigger

The trigger decides when the automation runs.

1. On the canvas, click **Select an Event**.

   *(Screenshot: The empty workflow canvas with the Select an Event box highlighted)*

2. In **Select Trigger Event**, click the event that starts the automation, for example **New Lead Received**.

   *(Screenshot: The Select Trigger Event panel with New Lead Received highlighted)*

3. Click the trigger on the canvas, then click the gear button under it to open its settings. You can also double-click a node.
4. Choose which forms it applies to, for example your form under **Lead Form**. Leave it empty to run for all forms. Payment triggers ask for a **Payment Source Type** first, such as **Payment Form**, then a **Specific Form**.

   *(Screenshot: The New Lead Received Trigger Settings with the Kopi Kampung Wholesale Enquiry form selected under Lead Form)*

5. Click **Save Trigger**.

## Add an action

BCL joins the actions one after another, from the trigger down.

1. Click the trigger on the canvas to select it, then click **Add Node**. BCL joins the new node to the one you selected.
2. In **Add Action**, click the action for BCL to do, for example **Send Email**.

   *(Screenshot: The Add Action panel with Send Email highlighted)*

3. The new node shows a red mark until it is set up. Click it, click the gear button and fill in the settings. For **Send Email**:

   | Field | What to fill in |
   | --- | --- |
   | **Action Name** | A short name shown on the canvas. |
   | **Recipient Email** | An address, or `{email}` for the customer's email on payment triggers. |
   | **Email Subject** and **Email Content** | Your message. Click **Variables** to insert details such as a form answer. |

   *(Screenshot: The Email Action Settings with the recipient, subject and content filled in)*

4. To check the result, type your own address under **Test Email** in the same panel and send a test.
5. Click **Save Email**.

Add more nodes the same way. Under a selected node, the buttons next to the gear copy or delete it.

## Save and switch it on

You save the settings of each node one by one. You must also save the workflow.

1. Click **Update Automation**.

   *(Screenshot: The finished workflow with the Update Automation button highlighted)*

2. Check that it is on. The button at the top says **Deactivate** when the automation is on, and **Activate** when it is off. On the **Automations** list, the **Status** switch shows the same.

## Tips

Build carefully, because an automation runs by itself:

- **Test with your own details first.** Use the test option in the action, or make a test purchase in Test Mode. Then check the [automation's history](/automation-history/).
- **Choose specific forms in the trigger.** An empty form list means every form. It is easy to forget this when you add a new form later.
- **Tidy up a busy canvas.** Click **Tidy up** above the canvas, or right-click an empty part of the canvas and choose **Tidy up**. BCL lines up every node in columns that follow the flow. Click undo to put them back. The button works when the workflow has two or more nodes.

  *(Screenshot: The Tidy up button above the automation canvas)*

- **Use the variable picker.** BCL sends a mistyped variable as an empty value, with no error. So choose variables from **Variables**, and do not type them.

## Common issues

### How do I send an email to my sales team every time a customer sends a lead form?

Create an automation with the New Lead Received trigger, choose your form under Lead Form, then add a Send Email action with your team's address as the Recipient Email.

### Why is there a red mark on a node in my workflow?

The node is not set up yet. Click it, click the gear button under it, fill in the required fields and save.

### How do I put the customer's name or a form answer into the message?

Click Variables next to the field and choose one from the list. Payment automations use names like {name} and {order_number}, and lead form fields look like {full_name:1}.
