All Content
Timespan
explore our new search
How to use Compose in Power Automate
Power Automate
Sep 26, 2023 11:52 AM

How to use Compose in Power Automate

by HubSite 365 about Reza Dorrani

Principal Program Manager at Microsoft Power CAT Team | Power Platform Content Creator

Citizen DeveloperPower AutomateM365 Hot News

Explore the versatile compose action in Power Automate and its use in data operations. Stay tuned for more insights!

In this summary, we explore the 'compose' action in Power Automate, as presented by Reza Dorrani [MVP] in a you tube video. This particular action is a versatile element among the data operations available. It accepts any data input and produces an output without requiring a predefined data type.

The 'compose' action stands out in its simplicity and utility. Unlike working with variables that can be initiated and updated, 'compose' can be set only once, making it akin to a constant. This property makes it highly useful when a single, unchanging value is needed throughout a flow.

Moreover, 'compose' simplifies the debugging process in Power Automate. It allows for greater transparency of data used in conditions and transformations by providing clear visibility of the inputs leading up to a conditional statement. This feature is invaluable for troubleshooting and ensuring flow accuracy.

To use the 'compose' action, one can easily find it by adding a new action in Power Automate and searching for 'compose' or navigating to 'Data Operation'. However, users sometimes face a challenge where the 'Output' of composed actions only displays as 'Outputs', which can be vague and less informative.

As a pro tip by Pieter Veenstra, creating a JSON object in 'compose' can help clarify the output. By assigning dynamic content or expressions to key-value pairs in the object, users can later reference the keys for clarity.

  • Create a JSON object with {} and define fields with names and values.
  • Use the following example to reference values
  • outputs('Compose')?['MyColumn']

After refreshing the flow, dynamic content will display field names instead of the generic 'Outputs', providing a clearer indication of what each 'compose' is handling. Checking a flow run's outputs confirms that the details are as anticipated.

For those seeking to delve deeper into the functionalities of Power Automate and the 'compose' action, please click here for more information. The teased upcoming content includes discussions on Join, Select, Filter array, and Create, providing a comprehensive look at data operations within Power Automate.

 

 

Understanding Power Automate 'Compose'

The 'compose' action in Power Automate is a foundational tool for managing data in automated workflows. As a versatile action, it offers significant flexibility for users to insert any type of data and retrieve the results post-processing. This element serves as a cornerstone, enhancing troubleshooting capability during the development and testing of automated sequences. Its unique attribute of being initialized only once per flow instance positions it ideally for operations demanding consistent value references. Further, the 'compose' action does not require tedious data type specifications, making it user-friendly for a wide array of tasks. As Power Automate continues to evolve, mastering the 'compose' action is crucial for creating robust, efficient, and error-free processes.

Learn about Compose in Power Automate

The explore function, one of the pivotal data operations within Power Automate, will be the key focus of this article. Through a deep dive into functionalities such as the formation and use of compose actions, we will broaden our understanding of the mechanisms behind the software and the advantages it offers.

The explore action belongs to the catalogue of data operations within Power Automate. The beauty of this feature lies in its versatility - it embraces any data type provided and offers an output based on any requirements we feed into it. To further elaborate on its usability, any hard coded material sent as an input will be returned as is. However, introducing dynamic content or expressions can result in varying outputs.

When does it differ from variables, and when should we use the explore function? The answer lies substantively in the behavior of Power Automate’s variables - they can be initialized and updated numerous times within the flow. Comparatively, the explore function doesn't perform in such a way. It arises as a preferred option when you need to set a value once and wish to access it from any section of your flow after the ‘setting’ step. Think of it as a consistent static variable that can only be set once and cannot change until a new data set comes along with a fresh flow.

Power Automate - Creating Processes Efficiently with Power Automate Guide

Moreover, the explore function significantly streamlines the debugging journey when examining flow runs. Certain actions within Power Automate do not present their output. For instance, in a condition framework, an expression's output will be solely true or false, indicating whether the provided value matched our specifications or not. Implementing the explore function before entering this condition allows us to see the data used in our comparisons. This leads us to a more efficient resolution when identifying issues in our flows.

To leverage the explore function, simply proceed to add a new operation in your Power Automate cloud flow. Search for 'compose,' or within the built-in connectors/steps, select 'Data Operation,' followed by 'compose.'

Yet, potential challenges arise when using numerous compose actions. For example, for all the areas in your flow referencing dynamic content from a compose action merely state ‘Outputs.’ To overcome this, developing a JSON object within your compose action can help. This development transforms your original intention into a value against a field. You can further query this object in another place in your flow, expediting the process.

The JSON object execution looks a bit like this:

{
“MyColumn” : “MyOutput”
}

The future input, which could be another compose or a data adapter operation, could use this expression to reference the example mentioned earlier: outputs('Compose')?['MyColumn']. This small trick helps with understanding which data is held within the compose actions.

The insight into the explore function assists you in comprehending the Power Automate compose action in a broader sense. By being transparent and demonstrating different scenarios, we aim to keep the functionality elucidation process as simple as possible. As we proceed through the week, stay tuned to learn about four other data operations within Power Automate.

Keywords

Power Automate composition, Compose action Power Automate, Using Compose in Power Automate, Power Automate Compose usage, Power Automate Compose guide, Tips for Power Automate Compose, Compose function in Power Automate, Automate processes with Compose, Power Automate Compose tutorial, Power Automate Compose steps