Paging in Dynamics 365 Customer Engagement v 9.0

Paging in Dynamics 365 Customer Engagement v 9.0 :

Day to Day Dynamics CRM going very interestingly with lot of exciting features has been . One of the interesting features is client side scripting in dynamics 365 customer engagement.

If we want to retrieve multiple records , here is the syntax.

Xrm.WebApi.retrieveMultipleRecords(entityLogicalName, options, maxPageSize).then (successCallback, errorCallback);

entityLogicalNameentity logical name of the retrieve records for eg : “account”.

options : O Data system query options or FetchXML query to retrieve your data.

  • Following system query options are supported: $select$top$filter$expand, and $orderby.
  • To specify a FetchXML query, use the fetch xml  to specify the query.

maxPageSize : Specify a positive number that indicates the number of entity records to be returned per page. If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified maxPageSize value, nextLink attribute in the returned object will contain a link to retrieve the next set of entities.

nextLink: String. If the number of records being retrieved is more than the value specified in the maxPageSize parameter in the request, this attribute returns the URL to return next set of records.

function paging(){

var query = “?$select=name”;
var allaccounts = null;

function retrieveMultipleAccounts() {

var url = Xrm.Utility.getGlobalContext().getClientUrl()+ “/api/data/v9.0/accounts”;
Xrm.WebApi.retrieveMultipleRecords(“account”, query, 5000).then(
function success(result) {
var resultRetrieved = result;
allaccounts = resultRetrieved.entities.concat(allaccounts);
if (result.nextLink != undefined) {
console.log(“Next page link: ” + result.nextLink);
query = result.nextLink;
//result.nextLink contains url, we need to remove the url and has to pass only query.
var splitValue = query.split(url);
query = splitValue[1];

function (error) {



//allrecords variable contains the all values:

Hope it helps .

Enjoy 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s