How to use Inline Expression in Flow

You can use the Inline Expression feature to apply custom codes on the inputs of any action. This eliminates the need for you to use the Node.js Code action each time you wish to add custom logic to your workflow. Let’s understand how this works with the help of an example.

Let’s say you wish to create a workflow that triggers  whenever a new item is added to the specified list of your ‘Wunderlist’ account. It should then automatically append the word ‘added to your tasks’ to the item name (e.g., Meeting @ 4pm added to your tasks) and send it via Gmail to the specified recipient. 

Let’s look at the steps that are required to create and configure this workflow.

Step 1: Add and Configure Wunderlist Trigger

Add ‘Wunderlist - New Item’ trigger and configure it as given below: 

Wunderlist - New Item: Select the ‘Wunderlist’ authorization and in the ‘List ID’ field, select/specify the ID of the list for which you want to set the trigger. 


Click on ‘Save’. After this, you will be redirected to the ‘Test Trigger’ window, where you can check if you have configured the trigger settings properly.


Once you are done with testing trigger, click on 'Done' to return back to your canvas.

Step 2: Add and configure Gmail - Send an Email’ action

Add ‘Gmail - Send an Email’ action and connect it to the ‘Wunderlist’ trigger as shown below:


Configure the ‘Gmail_Send an Email’ action. We will use the ‘Inline Expression’ block of this action to add custom logic that appends the word ‘added to your task’ to the Wunderlist Item, before sending it to a specific recipient. 

Gmail - Send an Email: 

To: Enter the email ID(s) of the recipient(s) to whom you wish to send the mail. 

Subject: Enter a subject of the mail.

Body: Click on the ‘Inline Expression (</>)’ icon given on the right hand side of the input field. 


This will open a new console window. 


Click on the 'Create - Trigger Data' output parameter given on the right-hand side of the console window. This will add the output of the trigger (i.e., the title and other details of the newly added item in Wunderlist) to your console window as an input. You can now write the code you wish to apply on this input. For example, the code that we have added is, '$trigger.title + "added to your tasks";'. 


Once you have written the code, click on ‘Save’. This will take you back to ‘Send an Email’ action configuration window. 



You will see that the ‘Input Expression’ has been added in the ‘Body’ field.

Click ‘Next’, and test the action by clicking on the ‘Test’ button. When you click this button, checks whether the action has been configured properly, and sends the email to the specified recipient, and displays the details in the ‘Output’ tab that appears. 

Now, click on ‘Done’ and ‘Save’ the workflow. 

Now, whenever a new item is added to the specified list of your Wunderlist account, it will trigger this workflow. The workflow will fetch the details of the item and will apply the code written in ‘Inline Expression’ block which will append the text ’added to your task’ to the name of the item and will send it to the specified recipient.