Skip to main content

Invoke Macro

The Invoke Macro action runs a macro as a step inside another automation. The macro runs with its own private set of variables, receives the input values you supply, and returns its output to the calling automation.

Use this action to share logic across hosted mailboxes, remote mailboxes, scheduled tasks, Agentic Actions, and other macros without duplicating action steps.

Availability​

This action is included with Developer Toolkit. If your subscription does not include Developer Toolkit, the action does not appear in the action picker. Contact your account manager to add Developer Toolkit to your subscription.

When to Use This Action​

Use this action when:

  • You have logic (a lookup, a ticket-creation sequence, a notification) that more than one automation or agent needs to run.
  • You want to keep individual automations small by extracting a multi-step sequence into a reusable unit.
  • You want an Agentic Action to perform a specific, well-defined task as a tool call.
  • You want to test the same logic in isolation before wiring it into production triggers.

Don't use this action for:

  • One-off logic that runs in only a single automation. Build the steps directly in the automation instead.
  • Branching that only affects the current automation's flow. Use Iterate and other control structures inline.

How It Works​

A macro works like a self-contained unit with its own private set of variables. Steps inside the macro cannot read or change the variables of the automation that calls it, and the calling automation cannot see the values the macro uses along the way. Data crosses between them in only two places: the Macro Inputs you pass in, and the output the macro returns.

Your inputs use the calling automation's data​

When this action runs, it first resolves each Macro Inputs value using the calling automation's data. A value such as {{custom.ticket.Title}} or {{email.subject}} becomes the actual ticket title or email subject, and the macro receives that finished value. History logs mask any input marked as password in the macro's input schema.

If the macro you selected was deleted, the action records an exception and stops instead.

The macro works with its own variables​

Inside the macro, steps read the values you passed in with {{input.name}}. Apart from those inputs, the macro starts with no variables, and it cannot refer to the calling automation's variables or to the email that started the automation. If a step inside the macro needs a value, add it to the macro's inputs and pass it in.

As the macro's steps run in order, they can store working values in {{custom.name}}. These values stay inside the macro. Steps save the values the macro should return in {{output.name}}.

For example:

Calling automationMacro Inputs valueInside the macro
{{custom.ticket.Title}} contains Backup failed on SRV01text set to {{custom.ticket.Title}}{{input.text}} contains Backup failed on SRV01
{{custom.ticket.Title}} contains Backup failed on SRV01Not passed in{{custom.ticket.Title}} is empty

Only the output comes back​

When the macro finishes, the action returns the macro's output to the calling automation and stores it in the variable you name in Store results in variable. The action discards the macro's inputs and working values. Apart from that result variable, the calling automation's variables are exactly as they were before the macro ran.

If the macro ends early, it still returns any output it saved before that point. A history entry records the macro name, outcome, message, and returned output.

History keeps the macro's actions and completion together beneath the Invoke Macro step. When an Agentic Action calls the macro as a tool, History keeps those entries beneath that single tool call instead. The entries show the inputs and output for that invocation, while password inputs remain masked.

If the macro itself raises an exception, the calling automation receives the exception and follows your exception-handling rules.

Actions inside a macro can use Continue, Exit Macro, or Exception for error outcomes:

OutcomeMacro behavior
ContinueIgnores the error and runs the macro's next action.
Exit MacroEnds the current macro, returns partial output, and resumes the calling automation at its next action.
ExceptionEnds the current macro, returns partial output, and reports the failure to the calling automation.

The standalone Exit Macro action provides the same local exit behavior for conditional branches that are not error outcomes. When one macro invokes another, Exit Macro exits only the nearest macro.

Configuration​

FieldDescription
MacroSelect the macro to execute. The list shows every macro defined for your organization.
Macro InputsThe values to pass into the macro. The fields shown here come from the selected macro's inputs. Each field accepts text expressions that use the calling automation's data, such as {{custom.name}}, {{email.subject}}, or {{global.name}}. Inside the macro, steps read each value as {{input.name}}. Password inputs are stored as secret values and masked in history logs.

The Macro Inputs pane only appears after you select a macro. If you change the selected macro, the input fields rebuild to match the new macro's schema.

Returned Variables​

The action stores the macro's output in the variable name you provide in Store results in variable. The result contains the properties defined in the macro's output schema.

For example, if the macro defines an output schema with contact and account properties and you store the result in lookup, you can reference:

VariableDescription
{{custom.lookup.contact}}The contact value the macro saved to its output.
{{custom.lookup.account}}The account value the macro saved to its output.

If the macro has no output schema, the action stores everything the macro saved to its output. The output is still available when the macro ends early because of Exit Macro or Exception.

FAQs​

What happens if the macro is deleted?​

The action records the exception "Macro <name> has been deleted and cannot be executed." The calling automation receives the exception and follows your exception-handling rules. Update or replace the Macro field to point at an active macro.

Can a macro call another macro?​

Yes. Invoke Macro is available as a step inside macros, so you can build larger automations from smaller reusable units. Every macro call has its own private set of variables, so a macro called from another macro cannot see the calling macro's variables either. Pass the values it needs through Macro Inputs.

Can the calling automation see the macro's variables?​

No. A macro's inputs and working values exist only while that macro runs. The calling automation receives only the output the macro returns, through the variable you set in Store results in variable.

This also applies to global variables. Steps inside a macro cannot read or change the calling automation's global variables. To use a global value inside a macro, pass it in through Macro Inputs, for example {{global.contact.id}}.

How do I test a macro before invoking it from production?​

Click Apps in the top bar, then click Macros. Select the macro and use the Test button on the detail page. The shared test modal lets you supply sample inputs, runs the macro end-to-end, and records the run in History under a macro_test trigger so you can inspect every step.

Can Agentic Actions call macros?​

Yes. When you configure an Agentic Action, its Tools picker lists every macro alongside built-in actions and other Agentic Actions. The Agentic Action invokes the selected macro using this same action.

  • Macros: create, edit, and test reusable macros
  • Variables: how input, output, custom, and global behave inside and outside macros