Logic Composer
Queries steps
Reference for the steps that read, aggregate, update or delete every row a query finds, and that batch many changes together.
Queries steps work on sets of rows. You describe the rows with a query, built the same way everywhere in Composer: choose the table and columns, add conditions in And / Or groups using the Dataverse operators (Equal, Contains, Last X Days, Under and so on), join related tables, and set the sort order.
Execute Query
Section titled “Execute Query”Reads the rows a query finds.
| Setting | What it does | Required |
|---|---|---|
| Multiplicity | Single (one row), All (every matching row) or Sliced (one page). Fixed once the step is saved. | Yes |
| Page Number | The page to read. | For Sliced |
| Page Size | The number of rows per page. | For Sliced |
| Query | Table, columns, conditions, related tables and sort order. | Yes |
Outputs: <Step>. With Single, one row, empty when nothing matches. With All, the list of rows. With Sliced, the rows of that page.
Behavior: a query that finds nothing does not fail. Check a Single result for empty with a Condition, and a list with Collection Count, before you use it.
Example: find all active Contacts of the Account (All), then send each of them a welcome email inside an Iterator.
Aggregate Query
Section titled “Aggregate Query”Counts, sums, averages, or finds the minimum or maximum over the rows a query matches. The calculation runs on the server, so no rows are read into the flow.
| Setting | What it does | Required |
|---|---|---|
| Function | Count records, Count values in a column, Sum, Average, Minimum or Maximum. | Yes |
| Column | The column to aggregate. Sum, Average, Minimum and Maximum need a number, decimal or currency column. | For every function except Count records |
| Query | The rows to aggregate. Its columns and sort order are ignored. | Yes |
Outputs: <Step>.Output.value.
- The counts return a whole number, 0 when nothing matches.
- The other functions return a decimal number, empty when nothing matches. A Currency column comes back as its decimal amount.
Limits: Dataverse limits aggregates to 50,000 matching rows. The step also works on-premises.
Example: sum Est. Revenue of an Account’s open Opportunities, and save the result in the Account’s “Open Pipeline” column.
Update Records from Query
Section titled “Update Records from Query”Sets the same fields on every row a query finds.
| Setting | What it does | Required |
|---|---|---|
| Maximum Records | The most rows the step may change. Default 5,000. | No |
| Query | The rows to update. | Yes |
| Add Field to Set | The fields to set and their values. Changing the query’s table clears them. | Yes, at least one (“Set a value for at least one field.”) |
Outputs: <Step>.Output.recordCount, the number of rows changed.
Behavior:
- All matching rows are found first. If there are more than Maximum Records, the step fails and no row is changed.
- The rows are then changed in batches of 100.
- The first failure stops the step. Rows changed in earlier batches stay changed, and the error says how many rows were processed. Put the step in a Try / Catch if you need to react to a partial update.
- Each row is changed once, even if the query returns it more than once.
- Field values are worked out separately for each row.
Example: when an Account is closed, set Do not allow Emails to Yes on all of its Contacts.
Delete Records from Query
Section titled “Delete Records from Query”Deletes every row a query finds. It works exactly like Update Records from Query, without fields to set.
| Setting | What it does | Required |
|---|---|---|
| Maximum Records | The most rows the step may delete. Default 5,000. | No |
| Query | The rows to delete. | Yes |
Outputs: <Step>.Output.recordCount, the number of rows deleted.
Behavior: if more rows match than Maximum Records, nothing is deleted. Otherwise rows are deleted in batches of 100, and rows deleted before a failure stay deleted.
Example: delete all Tasks that are still open on a cancelled Order.
Execute Multiple Request
Section titled “Execute Multiple Request”Creates, updates and deletes many rows in one batch.
| Setting | What it does | Required |
|---|---|---|
| Entities To Create | A list of rows to create. | At least one of the three |
| Entities To Update | A list of rows to update. | At least one of the three |
| Entities To Delete | A list of rows or lookups to delete. | At least one of the three |
If none is set, the step reports “No request to execute is specified.” If the lists are empty when the step runs, the step does nothing.
Outputs: none.
Behavior: the requests run in order and stop at the first one that fails; the step then fails and lists the errors. Requests that already succeeded are not undone unless the flow runs inside a record operation’s transaction.
Example: inside a Loop, build 12 monthly Payment Schedule rows and add each to a list variable; after the loop, create them all with one Execute Multiple Request.