Skip to content

Conditional Execution

You may want to execute a different actions based on certain conditions of the incoming message.

You can do this using If..Then.. Else.. End If blocks.

Simple If Blocks

Process Incoming
// Incoming support request
If%Msg_To%ContainssupportThen
If%Msg_Subject%Contains One Ofurgent,ticketThen
// Support email
If%Msg_Date%Hour Greater Than8And%Msg_Date%Hour Less Than18Then
// Day time
Send Teams MessageToSupport Team-General"Support Request: %Msg_Subject%"For Usersupport@mycompany.com
Else
// Out of hours
Send EmailTooutofhours@mycompany.com"Support Email: %Msg_Subject%"
End If
End If
End If

In the above example, we check that the incoming 'To' address contains 'support' then if the Subject contains either 'urgent' or 'ticket', then if the hour of the message is > 8 and <18 we send a Teams message, otherwise we send the email on to a 'outofhours' address.

Calling Other Automations

In addition to executing actions inside If blocks, you can also use the Call action to conditionally call an entire Automation.

Process Incoming
// Incoming support request
Result=
If%Msg_To%ContainssupportThen
If%Msg_Subject%Contains One Ofurgent,ticketThen
// Support email
If%Msg_Date%Hour Greater Than8And%Msg_Date%Hour Less Than18Then
// Day time
Result=CallProcess Support Emails(%Msg_Body%,Attachments*.*)
Else
// Out of hours
Result=CallProcess Out Of Hours(%Msg_Body%,Attachments*.*)
End If
End If
End If
Return%Result%