Build your first automation
This guide walks through building an automation from an empty canvas to a published automation that runs. It is for people who build automations in a workspace. You need the Workspace lead or Workspace operator role, or an organization role that covers the workspace. Publishing needs Workspace lead or an organization role.
The example starts from an Operation trigger, because you can run it yourself from the app. The steps are the same for any trigger.
1. Create the automation
Section titled “1. Create the automation”- Open Automation in the workspace rail.
- Click New automation.
Lainstack creates a draft called “Automation 1” (or the next free number) and opens it in the editor. To rename it, click the pencil next to its name at the end of the breadcrumb, type the new name and press Enter.
To start from a working example instead, click Templates, pick a template, give it an Automation name and click Create draft.
The editor saves as you go. There is no Save button.
2. Add a trigger
Section titled “2. Add a trigger”The Block library is on the left, with triggers listed first. Search it with Search blocks.
Click Operation, or drag it onto the canvas. Each trigger type can appear only once in an automation; once it is on the canvas, the library marks it In canvas.
Click the trigger to open its settings on the right. For an Operation trigger, add the fields people will fill in, such as a text field called “Reference”.
3. Add a block and wire it up
Section titled “3. Add a block and wire it up”Add the next block from the library, for example Set Value. A new block is placed below the selected one, but it is not connected yet.
Connect it by dragging from the trigger’s output, at the bottom of its card, to the new block’s input at the top. Exits work the same way: a block like Condition has one output per exit, and each can lead to a different block.
To remove a connection, select it and click the delete button. To remove a block, open its settings, click the Block actions menu and choose Delete block. Undo brings back anything you removed by mistake.
4. Configure the block
Section titled “4. Configure the block”Click a block to open its settings. They have up to three tabs:
- Setup: the block’s settings. Each setting is described on the block’s reference page.
- Samples: what the block produces, with example values you can pin (step 5).
- Test: only on blocks that run your own code, such as JavaScript Transform.
Each tab shows how many issues it has. Missing required values are flagged once you edit the field, or when you click Publish, Run or Run draft; the editor then opens the first block that needs work.
Use data from earlier blocks
Section titled “Use data from earlier blocks”A setting can take its value from the trigger or any block before it. Either:
- type
@in the setting and pick an input from the list, or - click the setting, then pick from the Inputs list next to the settings. Suggested shows the inputs that fit that setting. You can also drag an input into the setting.
In a text setting you can mix typed text and inputs.
5. Pin a sample
Section titled “5. Pin a sample”A draft run needs an input for its trigger, and a sample is the simplest one. Each block can hold one Pinned sample on its Samples tab.
Open the trigger’s Samples tab and pin a sample in one of these ways:
- Capture from last run, once the automation has run. The fields fill with that run’s values, and you can change any of them.
- Draft with your assistant, which fills the fields from the block’s declared outputs and settings. A note stays until you edit them. Run draft offers the same for every block the run may stop at.
- Fill in the fields yourself. A block whose fields depend on its setup offers Add field: name each one and choose its type.
The sample also tells the editor what the trigger produces, so later blocks can map from it in step 4.
6. Test it
Section titled “6. Test it”Click Run draft in the editor header. It is available once the trigger has an input to use.
Choose where the trigger’s input comes from: A past run, Pinned sample or Fill the form. Reads and computation run for real. Blocks that write, send or delete are held: nothing is sent, and the block shows what it would have written. A held block passes on its pinned output, or else the output of its last real run, or else the plan some blocks give, so the blocks after it still run; with none, the branch stops there.
Click Start. The editor opens the new run on the canvas. Open a block’s Run tab to see its input and output, and use Run from here to run it again after an edit. A held block’s output is a stand-in, not a real response. See Runs in the editor for all of this.
7. Publish
Section titled “7. Publish”Click Publish. If anything needs fixing, the button is dimmed and the issues are listed; fix them and try again. If publishing would change what an Agent block may read in the workspace, you’re asked to confirm that change first.
Publishing makes the current draft the live version and switches the automation’s Run state to Active, which turns its triggers on. The status in the header changes from “Draft · never published” to “Published v1 · up to date”.
After publishing:
- Later edits stay in the draft until you publish again. The header shows “changes not live” until you do. To throw away unpublished edits, use Discard draft changes from the status menu.
- Switch Run state to Paused to stop the triggers without unpublishing. Publishing again makes it active again.
8. Run it
Section titled “8. Run it”An automation with an Operation trigger can be run straight from the editor: click Run, fill in the form and submit. It always runs the last published version, and the editor opens the run once it starts. The same form is listed under Operations in the workspace rail for everyone in the workspace.
Other triggers start runs on their own once published: a webhook when it is called, a schedule when it is due. See Triggers.
Keyboard shortcuts
Section titled “Keyboard shortcuts”| Keys | Does |
|---|---|
| Cmd or Ctrl + K | Search actions, blocks and places. |
| Cmd or Ctrl + Z | Undo. |
| Shift + Cmd or Ctrl + Z | Redo. |
| Delete or Backspace | Remove the selected connection or block. |
| Arrow keys | Move between connected blocks. |
| Enter | Open the selected block’s settings. |
| Esc | Close the settings. |
- Triggers
- Connections and credentials, for blocks that call other systems.
- Escalations and approvals, to put a person in the loop.