Introduction
In Power Automate, the Compose action plays a crucial role in handling data within a flow. It allows you to store values—such as text, numbers, arrays, or complex JSON structures—temporarily, making them easy to reference and reuse. Whether you’re simplifying expressions, storing intermediate results, or preparing data for further actions, Compose provides a clean and efficient way to manage data logic. This is especially useful when dealing with structured outputs from services like HTTP requests or databases, where you need to extract and manipulate specific fields without repeatedly writing complex expressions.
Compose action
The Compose action in Power Automate is used to create and store data temporarily within a flow. It can be used to build or manipulate structured data like JSON, strings, numbers, or arrays, and then reference that data later in the flow without recalculating or repeating logic.
Why Compose is Most Commonly Used:
-
Simplify Expressions
You can write a long expression once in Compose (like concat(...), formatDateTime(...), etc.), give it a name, and reference it later. This improves readability and makes your flow easier to maintain.
Example
formatDateTime(utcNow(), 'yyyy-MM-dd')
-
Hold Intermediate Values
Store intermediate results between actions (like extracted text, filtered data, or calculated totals).
-
Build JSON or Arrays
Use Compose to build structured data that will be passed to APIs, loops, or other systems.
-
Debug and Inspect Values
Since Compose outputs are visible in run history, it’s a quick way to test and see what your expression returns.
Example JSON Data
{
"body": {
"headers": [
{
"sha1": "08f96a6ac4300",
"headers": [
{
"Subject": "You missed a VM= | Transcription Available Play Now 02min57se= 3pm|Friday-February-2024 12:21 PM"
},
{
"Message-Id": "<[email protected]>"
},
{
"Content-Transfer-Encoding": "7bit"
}
],
"filename": "rawHeaders.txt",
"sha256": "89525511f796c492eb"
}
],
"addresses": {
"to": [
"jeom"
]
},
"links": [],
"phishml": {
"confidence_spam": "0.0002689999237190932",
"confidence_clean": "0.00001319524653808912",
"category": "threat",
"confidence_threat": "0.9997478127479553"
},
"history": [
{
"date": "2024-02-16T16:08:21-05:00",
"events": {
"phishrip_started": {
"queried_fields": [
"from",
"subject"
],
"time_range": {
"start_time": "2024-02-15T16:08:15-05:00",
"end_time": "2024-02-16 21:08:15 +0000"
},
"quarantine": "true",
"id": "7dd22796-c400-4b9f-9c74-3f198272a36d",
"status": "processing"
}
},
"causer_name": "Threat Email Notification for Reporter"
},
{
"date": "2024-02-16T16:08:15-05:00",
"trigger_name": "One of three different names here",
"causer_type": "Action",
"event_type": "other",
"trigger_type": "User",
"events": {
"emails": [
{
"action_email_id": "c4ba53c9-8932-40a7-a347-f0cb74d04f15",
"to": [
""
],
"email": "Threat Email Notification for Reporter",
"status": null
}
],
"changed_fields": {
"action_status": [
"received",
"resolved"
]
}
},
"causer_name": "Threat Email Notification for Reporter"
},
{
"date": "2024-02-16T16:07:56-05:00",
"trigger_name": null,
"causer_type": "User",
"event_type": "other",
"trigger_type": null,
"events": {
"changed_fields": {
"viewed": [
false,
true
]
}
},
"causer_name": "NAME HERE"
},
{
"date": "2024-02-16T15:22:35-05:00",
"trigger_name": null,
"causer_type": "Action",
"event_type": "other",
"trigger_type": null,
"events": {
"emails": [
{
"action_email_id": "0ebd75cc-23ea-4f91-8459-023f81e6c891",
"to": [
""
],
"email": "Threat Email Notification for Admin",
"status": null
}
],
"tags": {
"added": [
"MANUAL"
]
},
"changed_fields": {
"severity": [
"unknown_severity",
"critical"
],
"category": [
"unknown",
"threat"
]
}
},
"causer_name": "Threat Notification for Admin"
},
{
"date": "2024-02-16T15:22:34-05:00",
"trigger_name": null,
"causer_type": "Rule",
"event_type": "other",
"trigger_type": null,
"events": {
"tags": {
"added": [
"KB4:SPF_PASS"
]
},
"changed_fields": {
"pipeline_status": [
"processing",
"processed"
]
}
},
"causer_name": "KB4:URGENCY"
},
{
"date": "2024-02-16T15:22:26-05:00",
"trigger_name": null,
"causer_type": "Intert",
"event_type": "other",
"trigger_type": null,
"events": {
"report": {
"name": "VirusTotal",
"results": [
{
"field": "attachment",
"value": "JPQN.png"
},
{
"field": "autoscan",
"value": "SHA-256 not found."
}
]
},
"tags": {
"removed": [
"VT_PENDING"
],
"added": [
"VT_HASH_NOT_FOUND"
]
}
},
"causer_name": "VirusTotal"
},
{
"date": "2024-02-16T15:22:22-05:00",
"trigger_name": null,
"causer_type": "Integrations::PhishMl::Report",
"event_type": "other",
"trigger_type": null,
"events": {
"report": {
"name": "Phish ML",
"results": [
{
"field": "clean",
"value": "0.00"
},
{
"field": "spam",
"value": "0.03"
},
{
"field": "threat",
"value": "99.97"
}
]
},
"tags": {
"added": [
"PML:THREAT"
]
}
},
"causer_name": "Phish ML"
},
{
"date": "2024-02-16T15:22:10-05:00",
"events": {
"part": {
"name": "JPQN.png"
}
},
"causer_name": null
},
{
"date": "2024-02-16T15:22:10-05:00",
"causer_name": null
}
],
"bad_links": [],
"tags": [
"SUCCESS_TAG"
]
}
}



Join the conversation! Your thoughts help the community grow.