Get started with expressions

Completed

To write an expression in Power Automate, select a field to open the Dynamic content menu and then select Expression as shown here.

Screenshot of opening the Dynamic content menu and selecting Expression.

The formula box is where you can type your expressions by combining one or more functions. Before you learn about the different types of functions and their usage, there are some commonalities you should learn first. Function names aren't case-sensitive.

Tip

Notice in the screenshot that we used a Manually triggers a flow trigger and a Compose action. This allows you to have a simple setup for writing and testing your expressions without worrying about other inputs or actions. Use this setup to follow along in this app or any time you want to try out something new.

When you enter a function in the formula bar, you see a pop-up with syntax suggestions.

Screenshot of pop-up with syntax suggestions.

Here you can see for the convertFromUtc function that it has two required inputs and one optional input.

  • Timestamp is required and expects a string.

  • destinationTimeZone is required and expects a string.

  • format? is optional and expects a string.

    Note

    The question mark at the end of format tells you that it is an optional input.

After you enter a Timestamp as a string then typing a comma, the flow prompts for the destinationTimeZone:

Screenshot of prompt for the destinationTimeZone.

This can be daunting. What does it want for the time zone? If you look in the pop-up, you see that it provides a link to the list of time zone values. This page provides you with the string for the destinationTimeZone. With that information, we can now complete the expression.

convertFromUtc('2024-02-09T12:00:00Z','Eastern Standard Time')

Once the expression is completed, you can select OK to save your changes. Always be sure to select OK or UPDATE when editing an expression. If you select out of the inputs, you lose your changes. Power Automate doesn't have AutoSave.

With your first expression complete, you can now select Test in the top right-hand corner. Then select Save & Test.

Once the test is complete, you should see the green bar that says, "Your flow ran successfully." Expand the Compose action and you see that the OUTPUTS is your date time converted to the new time zone.

Screenshot of successful flow bar with the message Your flow ran successfully.

Use this same process to see the output of any test expressions you create.