Data Objects and Operations in Cloud Flows
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 9 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Data Objects and Operations in Cloud Flows
Introduction: Understanding Data in Automation
When we talk about building cloud flows—specifically within platforms like Power Automate or Logic Apps—we are essentially talking about the art of moving data from one place to another and transforming it along the way. At the heart of every successful automation is a deep understanding of data objects. Whether you are dealing with a simple string of text, a complex JSON object containing nested arrays, or a binary file attachment, your flow acts as a processor that reads, interprets, and modifies this information.
Why does this matter? Many beginners view cloud flows as a sequence of "actions" (e.g., "send an email," "create a record"). However, if you treat your flow only as a sequence of actions, you will eventually hit a wall where your automation fails to handle real-world data complexity. By mastering data objects and operations, you shift your perspective from "executing steps" to "managing data streams." This shift allows you to build flows that are resilient, maintainable, and capable of handling errors gracefully. This lesson will walk you through the anatomy of data in cloud flows, the core operations you need to master, and the best practices that separate amateur flows from professional-grade automations.
Not read yet
The Anatomy of Data Objects
In cloud flows, data is rarely just a single value. Most of the time, you are working with structured formats. The most common format you will encounter is JSON (JavaScript Object Notation). Understanding JSON is non-negotiable for anyone working with cloud automations because almost every connector—from SharePoint to Salesforce to HTTP requests—communicates using this format.
Understanding JSON Structures
A JSON object is a collection of key-value pairs. Think of it as a dictionary where the "key" is the label (e.g., "EmployeeName") and the "value" is the actual data (e.g., "John Doe"). When you receive data from a trigger, such as a new form submission, the platform parses that raw input into a JSON object that the flow can understand.
- Objects: Represented by curly braces
{}. They contain properties. - Arrays: Represented by square brackets
[]. They contain lists of items. - Strings, Numbers, and Booleans: The raw data types within those structures.
Callout: JSON vs. XML While modern cloud flows lean heavily on JSON, you may occasionally interface with legacy systems that use XML. JSON is generally preferred because it is lighter, easier for machines to parse, and maps directly to the object structures used in most programming languages. If you find yourself needing to convert between the two, remember that JSON is your primary data format within the flow engine; XML should be converted to JSON as early as possible in your flow logic.
Not read yet
Core Data Operations
Once you have data entering your flow, you need a set of tools to manipulate it. These operations allow you to filter, transform, and aggregate data to achieve your business goals.
1. Variables: The Building Blocks
Variables are temporary containers that store data for use later in the flow. They are essential when you need to track a state, perform a calculation, or build a complex string over several steps.
- Initialize Variable: This must be done at the very beginning of your flow. You define the name, the type (String, Integer, Boolean, Float, Array, Object), and the initial value.
- Set Variable: Use this to overwrite the existing value.
- Append to Variable: This is particularly useful for strings (e.g., building a log message) or arrays (e.g., adding items to a collection).
2. The Compose Action
The "Compose" action is perhaps the most underrated tool in the cloud flow toolkit. Think of it as a scratchpad. You can use it to perform expressions, format dates, or structure JSON blocks before sending them to a connector. It does not perform an action on an external system; it simply processes data within the memory of the flow.
3. Parsing JSON
When you receive an HTTP response or a complex trigger output, the data might be "untyped." This means the flow treats it as a single blob of text. By using the "Parse JSON" action, you provide a schema (a blueprint of what the data looks like). Once parsed, the flow gains "intelligence" about the data, allowing you to select specific fields from a dynamic content menu rather than typing out complex expressions.
Tip: Schema Generation You do not need to write JSON schemas by hand. Most platforms provide a "Generate from sample" button. Simply paste a sample of your JSON data, and the system will automatically create the schema for you. This saves time and prevents syntax errors.
Not read yet
Step-by-Step: Transforming Data with Expressions
Expressions are the "hidden" logic of cloud flows. They allow you to perform logic that goes beyond simple drag-and-drop actions. Whether you need to format a date, convert a string to uppercase, or perform mathematical calculations, expressions are the answer.
Scenario: Formatting a Date for an Email
Suppose you have a trigger that provides a date in ISO 8601 format (e.g., 2023-10-27T14:00:00Z), but your users want to see it as "October 27, 2023."
- Step 1: Add a "Compose" action.
- Step 2: Click inside the input box and select the "Expression" tab.
- Step 3: Use the
formatDateTimefunction. The syntax isformatDateTime(timestamp, format). - Step 4: Your expression will look like:
formatDateTime(triggerOutputs()?['body/date'], 'MMMM dd, yyyy'). - Step 5: Save the flow and test. The output will now be a clean, human-readable date string.
Common Expressions Reference Table
| Function Category | Function Name | Usage |
|---|---|---|
| String | concat() |
Joins two or more strings together. |
| String | replace() |
Swaps a specific character or word in a string. |
| Date | utcNow() |
Returns the current date and time in UTC. |
| Date | addDays() |
Adds or subtracts days from a given date. |
| Collection | length() |
Returns the number of items in an array. |
| Collection | first() |
Returns the first item in an array. |
| Logic | if() |
Returns one of two values based on a condition. |
Not read yet
Working with Arrays: Loops and Filtering
Real-world data often comes in lists. If you receive an array of 50 customer orders, you cannot process them one by one manually. You need to use iteration.
The "Apply to Each" Loop
The "Apply to Each" action is the standard way to iterate through an array. When you select an array from dynamic content, the platform automatically wraps your actions in this loop.
- Concurrency Control: By default, loops run sequentially. If you are updating records in a database, this is safe. However, if you are performing independent operations (like sending individual notifications), you can increase the "Degree of Parallelism" in the loop settings to make the flow run much faster.
- Warning: Be careful with high degrees of parallelism if you are hitting external APIs with rate limits. You might trigger an error if you send too many requests simultaneously.
The "Filter Array" Action
Instead of looping through everything and using a "Condition" inside the loop to skip items, it is much more efficient to filter the array first. The "Filter Array" action takes your full list and a condition, and it returns a new, smaller array containing only the items that match your criteria.
Example Process:
- Get all items from a SharePoint list (e.g., 100 items).
- Use "Filter Array" to keep only items where
StatusequalsPending. - Use "Apply to Each" only on the output of the "Filter Array" action.
This reduces the number of loop iterations significantly, making your flow faster and less prone to hitting execution limits.
Not read yet
Best Practices for Data Handling
To build robust automations, you must follow established industry standards. These practices prevent common bugs and ensure your flows are easy for others to maintain.
1. Use Meaningful Names
Never leave your actions named "Compose," "Compose 2," or "Apply to Each." Rename them to describe what they are doing (e.g., "Compose: Format Date for Email" or "Apply to Each: Process Pending Orders"). This makes debugging infinitely easier when you are looking at a flow history.
2. Validate Data Early
Do not wait until the middle of your flow to realize the incoming data is malformed. Use a "Parse JSON" action at the very beginning to validate the structure of the trigger output. If the validation fails, the flow will stop immediately, preventing "garbage-in, garbage-out" errors.
3. Handle Empty Values
One of the most frequent causes of flow failures is trying to access a property that doesn't exist (e.g., trying to read UserEmail from an object where the user field is null).
- The Solution: Use the
coalesce()function or anif()check. - Example:
if(empty(outputs('Get_User')?['body/email']), '[email protected]', outputs('Get_User')?['body/email']) - This ensures your flow provides a fallback value instead of crashing.
4. Minimize API Calls
Every time you use a "Get item" or "Update item" action inside a loop, you are consuming your API quota. If you have 500 items, you are performing 500 API calls. If possible, use "Batch" operations or OData filters to retrieve or update data in bulk.
Callout: The Power of OData Filters When using "Get items" or "List rows" actions, always use the "Filter Query" field. Do not download the entire database and filter it inside the flow. By using OData filters (e.g.,
Status eq 'Active'), you offload the processing to the source system, which is significantly faster and more efficient than processing data in the cloud flow engine.
Not read yet
Common Pitfalls and Troubleshooting
Even experienced developers run into issues. Here is how to navigate the most common traps.
The "Apply to Each" Trap
If you select a field that is not an array, but the platform thinks it might be, it will automatically create an "Apply to Each" loop. This is a common source of confusion.
- Fix: If you know for a fact that your data is a single object, you can use the
first()expression to select the item directly, which often prevents the flow from creating an unnecessary loop.
Timezone Issues
Cloud flows operate in UTC by default. If your business logic depends on local time (e.g., "only run this if it is before 5:00 PM local time"), you will run into trouble if your server is in a different timezone.
- Fix: Always convert your inputs to your specific local timezone using the
convertFromUtc()expression before performing any logic.
Variable Scope
Variables defined inside an "Apply to Each" loop are often problematic. Because loops can run in parallel, you might accidentally overwrite a variable value from another iteration.
- Fix: Avoid using "Set Variable" inside parallel loops. If you need to aggregate data, use the "Select" or "Join" actions instead, which are designed to work with arrays without side effects.
Not read yet
Advanced Data Transformation: Select and Join
When preparing data for a report or an email summary, you often need to transform a complex array of objects into a simpler structure.
The Select Action
The "Select" action allows you to "map" an array. You take an input array and define a new structure for each item. For example, if you have an array of users with 20 fields, but you only need the "Name" and "Email," the "Select" action allows you to create a new array with only those two fields.
The Join Action
Once you have your clean array of data, you may want to display it in a table or a comma-separated list. The "Join" action takes an array and a delimiter (like a comma, a semicolon, or an HTML table tag) and combines all the items into a single string. This is the secret to creating clean, professional-looking email summaries.
Comprehensive Key Takeaways
To summarize the essential concepts of managing data in cloud flows:
- Master the Data Format: JSON is the universal language of cloud flows. Understanding how to read, parse, and structure JSON objects is the most important skill for an automation developer.
- Leverage Expressions: Do not rely solely on drag-and-drop actions. Expressions provide the precision needed for date formatting, string manipulation, and logical checks that standard actions cannot handle.
- Filter Before You Loop: Always filter your datasets at the source (using OData queries) or via the "Filter Array" action before entering an "Apply to Each" loop. This improves performance and reduces API consumption.
- Validate and Default: Always account for empty or missing data. Use
coalesce()or conditional logic to provide default values so your flow doesn't fail when expected data is absent. - Use the Right Tool for the Job: Use "Compose" for scratchpad work, "Select" for mapping arrays, and "Join" for creating summaries. Knowing which tool to reach for prevents bloated, messy flows.
- Naming Matters: Rename every action in your flow. A flow with descriptive names is self-documenting and significantly easier to debug when something goes wrong six months down the line.
- Respect API Limits: Be mindful of the number of requests your flow makes to external systems. Use batching and filtering to stay within your service limits and keep your automations running smoothly.
By focusing on these principles, you will move beyond simply "making things work" and start building reliable, scalable automations that provide real value to your organization. Data is the fuel that powers your flows; treat it with care, structure it correctly, and your automations will be much easier to maintain.
Not read yet
Frequently Asked Questions (FAQ)
Why does my flow keep creating an "Apply to Each" loop when I only have one item?
This happens when the connector returns an array format even if there is only one result. You can bypass this by using an expression like first(body('ActionName')?['value']) to target the first item in the array directly, which prevents the auto-generation of the loop.
What is the difference between "Compose" and "Set Variable"?
"Compose" is a static calculation that exists only for the duration of that step. It is best for transforming data. "Set Variable" actually changes the state of a container that persists throughout the entire run of the flow. Use "Compose" whenever possible to keep your flows stateless and easier to debug.
How do I handle very large datasets?
If you are processing thousands of rows, do not use a standard flow. Look into pagination settings within your connector actions. If the dataset is truly massive, consider using a database-level process or an integration service that handles bulk data transfers more efficiently than a standard cloud flow.
Can I use my own custom functions?
Cloud flows do not currently support custom user-defined functions in the traditional sense. However, you can create "Child Flows" (reusable flows) that act as functions. You call the child flow, pass it input parameters, and receive an output, which is a great way to handle complex logic that you need to reuse across multiple projects.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
- Leveraging the Power Automate Ecosystem
- Leveraging the Power Automate Ecosystem Quiz5q
- Cloud Flows vs Desktop Flows
- Cloud Flows vs Desktop Flows Quiz5q
- Designing Desktop and Cloud Flow Automations
- Designing Desktop and Cloud Flow Automations Quiz5q
- Trigger Types for Cloud Flows
- Trigger Types for Cloud Flows Quiz5q
- Target Application and Browser Interactions
- Target Application and Browser Interactions Quiz5q
- Methods for Running Desktop Flows
- Methods for Running Desktop Flows Quiz5q
- Concurrent Flow Execution
- Concurrent Flow Execution Quiz5q
- Attended vs Unattended Desktop Flows
- Attended vs Unattended Desktop Flows Quiz5q
- HTTP Actions in Cloud and Desktop Flows
- HTTP Actions in Cloud and Desktop Flows Quiz5q
- Work Queues for Automation
- Work Queues for Automation Quiz5q
- Designing Custom Actions
- Designing Custom Actions Quiz5q
- Cloud Flow Calling Desktop Flow
- Cloud Flow Calling Desktop Flow Quiz5q
- Child Cloud Flows and Data Passing
- Child Cloud Flows and Data Passing Quiz5q
- External API Calls in Cloud Flows
- External API Calls in Cloud Flows Quiz5q
- Trigger Conditions and Concurrency
- Trigger Conditions and Concurrency Quiz5q
- Timeout and Retry Policies
- Timeout and Retry Policies Quiz5q
- Data Objects and Operations in Cloud Flows
- Data Objects and Operations in Cloud Flows Quiz5q
- Text Parsing JSON XML CSV
- Text Parsing JSON XML CSV Quiz5q
- UI Options in Desktop Flows
- UI Options in Desktop Flows Quiz5q
- Datatables Lists and Custom Objects
- Datatables Lists and Custom Objects Quiz5q
- Subflows in Desktop Flows
- Subflows in Desktop Flows Quiz5q
- External APIs in Desktop Flows
- External APIs in Desktop Flows Quiz5q
- Timeout and Retry in Desktop Flows
- Timeout and Retry in Desktop Flows Quiz5q
- Custom Actions in Desktop Flows
- Custom Actions in Desktop Flows Quiz5q
- Flow Control and Loops
- Flow Control and Loops Quiz5q
- Expressions in Cloud Flows
- Expressions in Cloud Flows Quiz5q
- Variable Actions for Flows
- Variable Actions for Flows Quiz5q
- Secure Input and Output Data
- Secure Input and Output Data Quiz5q
- Desktop Flow Priority and Queues
- Desktop Flow Priority and Queues Quiz5q
- Exception Handling Blocks
- Exception Handling Blocks Quiz5q
- Business Exception Error Handling
- Business Exception Error Handling Quiz5q
- Work Queues in Flows
- Work Queues in Flows Quiz5q
- Building a Custom Connector
- Building a Custom Connector Quiz5q
- Custom Connector Authentication
- Custom Connector Authentication Quiz5q
- Custom Connector Policy Templates
- Custom Connector Policy Templates Quiz5q
- Code in Custom Connectors
- Code in Custom Connectors Quiz5q
- Credential Management Practices
- Credential Management Practices Quiz5q
- On-Premises Data Gateway
- On-Premises Data Gateway Quiz5q
- Dataverse Solutions Components
- Dataverse Solutions Components Quiz5q
- Machine and Machine Group Requirements
- Machine and Machine Group Requirements Quiz5q
- Machine Registration Management
- Machine Registration Management Quiz5q
- Machine Group Management
- Machine Group Management Quiz5q
- Load Balancing Desktop Flows
- Load Balancing Desktop Flows Quiz5q
- Run Queue Operations
- Run Queue Operations Quiz5q
- Analyzing Flow Run History
- Analyzing Flow Run History Quiz5q
- Power Automate Analytics Dashboard
- Power Automate Analytics Dashboard Quiz5q
- Desktop Flow Monitoring
- Desktop Flow Monitoring Quiz5q
- Automation Performance Optimization
- Automation Performance Optimization Quiz5q
- Troubleshooting Flow Failures
- Troubleshooting Flow Failures Quiz5q
- Center of Excellence RPA Analytics
- Center of Excellence RPA Analytics Quiz5q
No PL-500 practice exam yet
Your points already work on 76 Amazon, CompTIA and Microsoft exams.
See the exams