You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/model-driven-apps/clientapi/reference/Xrm-WebApi/retrieveMultipleRecords.md
+46-2Lines changed: 46 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "retrieveMultipleRecords (Client API reference) in model-driven apps| MicrosoftDocs"
3
-
ms.date: 10/31/2018
3
+
ms.date: 01/20/2019
4
4
ms.service: powerapps
5
5
ms.topic: "reference"
6
6
applies_to: "Dynamics 365 (online)"
@@ -84,7 +84,7 @@ On success, returns a promise that contains an array of JSON objects (**entities
84
84
85
85
## Examples
86
86
87
-
Most of the scenarios/examples mentioned in [Query Data using the Web API](../../../../common-data-service/webapi/query-data-web-api.md) can be achieved using the **retrieveMutipleRecords** method. Some of the examples are listed below.
87
+
Most of the scenarios/examples mentioned in [Query Data using the Web API](../../../../common-data-service/webapi/query-data-web-api.md) can be achieved using the **retrieveMultipleRecords** method. Some of the examples are listed below.
For most single-valued navigation properties you will find a computed, read-only property that uses the following naming convention: `_<name>_value` where the `<name>` is the name of the single-valued navigation property. However, for mobile clients in offline mode, this syntax is not supported, and the single-value navigation property name should be used instead.
110
+
111
+
More information: [Lookup properties](../../../../common-data-service/webapi/web-api-types-operations.md#bkmk_lookupProperties)
112
+
113
+
Here are code examples for both the scenarios:
114
+
115
+
#### For online scenario (connected to server)
116
+
117
+
This example queries the accounts entity set and uses the `$select` and `$filter` system query options to return the name and primarycontactid property for accounts that have a primary contact:
118
+
119
+
```JavaScript
120
+
Xrm.WebApi.retrieveMultipleRecords("account", "?$select=name,_primarycontactid_value&$filter=_primarycontactid_value ne null").then(
121
+
functionsuccess(result) {
122
+
for (var i =0; i <result.entities.length; i++) {
123
+
console.log(result.entities[i]);
124
+
}
125
+
// perform additional operations on retrieved records
126
+
},
127
+
function (error) {
128
+
console.log(error.message);
129
+
// handle error conditions
130
+
}
131
+
);
132
+
```
133
+
134
+
#### For mobile offine scenario
135
+
136
+
This example queries the accounts entity set and uses the `$select` and `$filter` system query options to return the name and primarycontactid property for accounts that have a primary contact when working in the offline mode:
137
+
138
+
```JavaScript
139
+
Xrm.WebApi.retrieveMultipleRecords("account", "?$select=name,primarycontactid&$filter=primarycontactid ne null'").then(
140
+
functionsuccess(result) {
141
+
for (var i =0; i <result.entities.length; i++) {
142
+
console.log(result.entities[i]);
143
+
}
144
+
// perform additional operations on retrieved records
145
+
},
146
+
function (error) {
147
+
console.log(error.message);
148
+
// handle error conditions
149
+
}
150
+
);
151
+
```
108
152
### Specify the number of entities to return in a page
109
153
110
154
The following example demonstrates the use of the `maxPageSize` parameter to specify the number of records (3) to be displayed in a page.
0 commit comments