All Collections
Configure your account
How to use Workflow Expressions
How to use Workflow Expressions
Herbert Gutierrez avatar
Written by Herbert Gutierrez
Updated over a week ago

You can write workflow expressions as a way to vary parts of a workflow based on a set of conditions.

For example, if you want to escalate an incident to the specific on-call engineer for the affected product, Expressions will let you do that. This looks something like this:

  • If Affected Service is Payments:

    • Escalation Team = Payments Team

  • Else if Affected Service is Onboarding:

    • Escalation Team = Onboarding Team

  • Else:

    • Escalation Team is not set

Later on in your workflow, you can then use Escalation Team in any step that expects that type. So, we could pair that with an Escalate to PagerDuty step that uses the Escalation Team.

Defining an expression

  • Open Workflows in your dashboard and create or edit a workflow.

  • Navigate to the Workflow step where you want to use an expression, click "Use a variable" and then Add new expression to begin creating an expression.

  • Choose which type of expression you require.

  • In this example, we'll use "If... else...". Give your expression a name. This should be something short that suggests what the expression results in (e.g. Escalation Service, or Mailing Lists).

  • Choose a return type. This will decide what kind of thing your expression will return (e.g. a Slack Channel or some text).

  • Choose whether or not your expression will return multiple values:

    • Please note that not all conditions and steps will accept multiple values. For example, the 'Send message to Slack Channel' step expects one single channel. If you choose to return multiple items for a 'Slack Channel' expression, then it won't be available in the 'Send message to Slack Channel' options.

  • Define your conditions and the things you want to return when those conditions are met.

  • Define what happens when none of your conditions are met. You can either return 'nothing', or a default value. If you return nothing and then use the expression in a step that needs a value, we'll skip running the rest of the workflow from that step.

  • Click Add to finish creating your expression.

  • Continue with creating the rest of your workflow. When you create a condition or add a step that expects something matching the type you've defined, you should see it in the dropdown options.

That's all! Use workflow expressions to consolidate many workflows doing similar things into one general workflow that varies as needed for the incident at hand.

Did this answer your question?