Read Multiple Entities
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Connectors,Lists,Tokens
Searches a Dynamics 365 / Dynamics CRM entity (table) with conditions and loads all the matching records into a list. Each record becomes one list entry, with a property for each attribute (column) you map.
You can then go through the list with Execute Actions for each List Entry, or use it with the other list actions. It can also read large results one page at a time.
This action is part of the Dynamics (CRM, 365) add-on (DnnSharp.DynamicsCrm). The add-on is installed separately and needs the DYNCRM feature in your license. If it isn't licensed, the action fails with a "not licensed" error. If you don't see the Dynamics actions, the add-on isn't installed.
Typical Use Cases
- Send an email to every contact of an account
- Copy Dynamics records into a database table with Import List into Database
- Export records to a file with Create CSV from List or Create Excel from List
- Return Dynamics data as JSON from an API with Existing List as JSON
- Count the records that match a filter with
Output Total Records Count
Don't use it to
- Read one record by its GUID. Use Read Entity instead.
- Get only the first match as tokens. Use Find Entity instead.
Related Actions
| Action Name | Description |
|---|---|
| Find Entity | Loads the first matching record into tokens. |
| Read Entity | Reads one record by its GUID. |
| Execute Actions for each List Entry | Runs actions once for each record in the list. |
| Update Entity | Updates a record by its GUID, for example inside a loop over the list. |
| Delete Entity | Deletes a record by its GUID. |
| Test Connector | Checks that a Dynamics Service Connector can sign in. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Connector | The Dynamics Service Connector that holds the Dynamics server address and sign-in details. See Connectors. | No | empty | Yes |
| Context Entity Name | The name of the list to create, for example ContactsList. | Yes | empty string | Yes |
| Logical Name | The entity to search. The list shows the entities of the selected connector by display name. The value saved is the entity's logical name, for example contact or account. You can also type a logical name or a token. The value is converted to lowercase. | Yes | empty string | Yes |
| Id Mapping | The name of the list property that receives each record's GUID, for example ContactId. Leave it empty if you don't need the GUID. It can't be the same as one of the Entity Property Name values in Attribute Mapping. | Yes | empty string | No |
| Attribute Mapping | The attributes to read. For each row, enter the attribute's logical name in Attribute Name, for example fullname, and the list property to create in Entity Property Name, for example ContactName. Attribute names that don't exist on the entity are skipped. See List properties. | No | None | No |
| Conditions | The filter. Each row has a Logical Operator (And/Or), an Attribute Name (logical name), a Condition Operator and a Value. See Conditions. With no rows, all records are read. | Only in Value | None | No |
| Order By | Sorts the records. Each row has an Attribute Name and an Order Type. See Considerations. | No | None | No |
| Result Count | The number of records per page, for example 50. Paging is only used when both Result Count and Page Number are greater than 0. | Yes | 0 | No |
| Page Number | The page to read, starting at 1. | Yes | 0 | No |
| Paging Cookie | The paging cookie from a previous Read Multiple Entities with the same query. It helps Dynamics return the next page quickly. It's ignored when paging isn't used. | Yes | empty string | No |
| Output Paging Cookie | The name of the token that receives the paging cookie for the next page, for example ContactsPagingCookie. | No | empty string | No |
| Output Total Records Count | The name of the token that receives the number of records that match the query, for example ContactsTotal. | No | empty string | No |
Output Parameters Reference
| Output | Description |
|---|---|
List <Context Entity Name> | The list of records, one entry per record. Empty if nothing matches. |
[<Output Paging Cookie>] | The paging cookie to pass to the next page's Paging Cookie. Only created when Output Paging Cookie is set. |
[<Output Total Records Count>] | The number of matching records reported by Dynamics. Only created when Output Total Records Count is set. |
List properties
Each list entry has:
- The
Id Mappingproperty, if set, with the record's GUID - One property per row of
Attribute Mapping, named byEntity Property Name - For reference attributes (Lookup, Customer, Owner), three extra properties:
<Entity Property Name>:Id,<Entity Property Name>:Nameand<Entity Property Name>:LogicalName
Inside Execute Actions for each List Entry, use them as [ListName:PropertyName], for example [ContactsList:ContactName] or [ContactsList:ParentAccount:Id].
The values follow the same rules as Find Entity:
- If Dynamics returns a formatted value for the attribute, the property gets that. For example, an option set gives its label (
Active), not its number. - Date and time attributes are written in ISO 8601 format, for example
2026-09-27T14:30:00.0000000Z. Date Only attributes use the short date format of the current culture. - Otherwise, the raw value is used: money as its amount, option sets as their number, and references as the GUID.
- If the attribute is empty in Dynamics, the property is empty.
Conditions
Conditions work the same as in Find Entity. The Value column supports tokens. For In, NotIn, Between and NotBetween, put each value on its own line. Null and NotNull take no value. Rows are combined with And, and an Or row starts an Or group that includes the rows after it.
Paging
Without paging, the action reads what Dynamics returns in one request. Dynamics limits this, usually to 5,000 records. To read more, or to show results page by page:
- Set
Result Countto the page size,Page Numberto1, and setOutput Paging CookieandOutput Total Records Count. - For the next page, run the action again with the same query,
Page Numberincreased by one, andPaging Cookieset to the cookie token. - Stop when you've read
[<Output Total Records Count>]records, or when the list comes back empty.
Considerations
- Use a new list name. The action fails if a list with the same
Context Entity Namealready exists in the context. When reading several pages, use a different name per page, for exampleContactsPage[PageNumber]List. - Order Type isn't applied in 1.28. Sorting always uses ascending order, whatever
Order Typesays. - Use logical names. Entity and attribute names are the lowercase logical names, such as
emailaddress1, not display names such asEmail. - Map only what you need. Only mapped attributes are read. Fewer attributes make the request faster.
- Conditions compare with Dynamics values. For option sets, compare with the number, not the label. For references, compare with the GUID.
- The sign-in is cached. The connection is reused until its security token is about to expire. Use Test Connector to check a connector. See Add Connector to create one in actions.
- Errors. Wrong sign-in details, a wrong entity name or an invalid condition make the action fail. Use the
On Erroractions of Execute Actions to handle it.
Examples
To understand how to use the below examples, please see Running Examples.
In these examples, replace the connector Entry value with the ID of your own Dynamics Service Connector, or select the connector after importing.
1. Read the contacts of an account
This action reads every contact whose parent is the account in the AccountId token, sorted by name. It creates the ContactsList list. Each entry has ContactId, ContactName and ContactEmail. [ContactsTotal] holds the number of contacts.
{
"Title": "Read Multiple Entities",
"ActionType": "DynamicsCrm.ReadMultipleEntities",
"Description": "Load the account's contacts",
"Parameters": {
"Credentials": {
"Entry": "00000000-0000-0000-0000-000000000000"
},
"ContextEntityName": "ContactsList",
"LogicalName": "contact",
"IdMapping": "ContactId",
"AttributeMapping": {
"fullname": "ContactName",
"emailaddress1": "ContactEmail"
},
"Conditions": [
{
"LogicalOperator": "And",
"AttributeName": "parentcustomerid",
"ConditionOperator": "Equal",
"Value": "[AccountId]"
}
],
"OrderBy": [
{
"AttributeName": "fullname",
"OrderType": "Ascending"
}
],
"OutputTotalRecordsCount": "ContactsTotal"
}
}
Next, add Execute Actions for each List Entry with List Name set to ContactsList. Inside it, use [ContactsList:ContactEmail] and [ContactsList:ContactName], for example in a Send Email action.
2. Read one page of accounts
This action reads 50 accounts from the page in the PageNumber token, whose names start with the text in the Search token. It saves the cookie for the next page in [AccountsPagingCookie] and the number of matching accounts in [AccountsTotal]. For the first page, set PageNumber to 1 and AccountsPagingCookie to an empty value.
{
"Title": "Read Multiple Entities",
"ActionType": "DynamicsCrm.ReadMultipleEntities",
"Description": "Load a page of accounts",
"Parameters": {
"Credentials": {
"Entry": "00000000-0000-0000-0000-000000000000"
},
"ContextEntityName": "AccountsPage[PageNumber]List",
"LogicalName": "account",
"IdMapping": "AccountId",
"AttributeMapping": {
"name": "AccountName",
"accountnumber": "AccountNumber",
"primarycontactid": "PrimaryContact"
},
"Conditions": [
{
"LogicalOperator": "And",
"AttributeName": "name",
"ConditionOperator": "BeginsWith",
"Value": "[Search]"
}
],
"ResultCount": "50",
"PageNumber": "[PageNumber]",
"PagingCookie": "[AccountsPagingCookie]",
"OutputPagingCookie": "AccountsPagingCookie",
"OutputTotalRecordsCount": "AccountsTotal"
}
}
Each entry also has PrimaryContact:Id, PrimaryContact:Name and PrimaryContact:LogicalName, because primarycontactid is a lookup.
Revised 09/27/2026