Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

How I can retrieve data and print more 5000 record with pagination: javascript

Posted on by 10

Hi,

I want to develop grid with javascript without framework , and I need some help in order to retrieve all record and print it with concat (pagination)

this is my code : 

<html>
<head>
<meta>
<title>Hello, Bootstrap Table!</title>
<link src="">maxcdn.bootstrapcdn.com/.../bootstrap.min.css" rel="stylesheet">
<link src="">cdnjs.cloudflare.com/.../font-awesome.css" rel="stylesheet">
<style type="text/css">
.content-info {
background: #f9f9f9;
padding: 40px 0;
background-size: cover!important;
background-position: top center!important;
background-repeat: no-repeat!important;
position: relative;
padding-bottom:100px;
}

table {
width: 100%;
background: #fff;
border: 1px solid #dedede;
}

table thead tr th {
padding: 20px;
border: 1px solid #dedede;
color: #000;
}

table.table-striped tbody tr:nth-of-type(odd) {
background: #f9f9f9;
}

table.result-point tr td.number {
width: 100px;
position: relative;
}

.text-left {
text-align: left!important;
}

table tr td {
padding: 10px 20px;
border: 1px solid #dedede;
}
table.result-point tr td .fa.fa-caret-up {
color: green;
}

table.result-point tr td .fa {
font-size: 20px;
position: absolute;
right: 20px;
}

table tr td {
padding: 10px 40px;
border: 1px solid #dedede;
}

table tr td img {
max-width: 32px;
float: left;
margin-right: 11px;
margin-top: 1px;
border: 1px solid #dedede;
}


</style>

</head>
<body>
<script>
document.onreadystatechange = function () {
if (document.readyState === "complete") {
testFXML();
}
};

var fxml = ["<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
, "<entity name='account'>"
, "<attribute name='name' />"
, "<attribute name='adress' />"
, " <attribute name='age' />"

, "</entity>"
, "</fetch>"].join();
fxml = "?fetchXml=" + encodeURIComponent(fxml);



var testFXML = function () {
parent.Xrm.WebApi.retrieveMultipleRecords("account", fxml, 3).then(

function (resp) {
if (resp != null && resp.entities.length > 0) {

const tb = document.getElementById("tb");
let tr = [];
resp.entities.forEach(item => {
tr.push('<tr><td>' + item.name + '</td>')
tr.push('<td>' + item.adress + '</td>')
tr.push('<td>' + item.age + '</td>')
})
tb.innerHTML = tr.join("");
document.getElementById("result").classList.remove("hide"); // show
//I don't know how to retrieve this url and use it for my others request and next page
console.log("Paging cookie: " + resp.fetchXmlPagingCookie);


}
}
);
}


</script>

<input type="button" onclick="testFXML()" value="some entities testFXML" accesskey="s">
<section class="content-info">
<div class="container paddings-mini">
<div class="row">
<div id="result" class="col-lg-12">
<table class="table-striped table-responsive table-hover result-point">
<thead class="point-table-head">
<tr class="bg-light">
<th>name</th>
<th>adress</th>
<th>age</th>
</tr>
</thead>
<tbody id="tb"></tbody>
</table>
</div>
</div>
</div>
</section>


<script charset="utf8" src="">stackpath.bootstrapcdn.com/.../script>
<script charset="utf8" src="">cdnjs.cloudflare.com/.../script>

</body>
</html>
on this url they explainhow to use pagincookie but it's not printed on html
  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How I can retrieve data and print more 5000 record with pagination: javascript

    Hi,

    Please have a look at below article

    blog.magnetismsolutions.com/.../query-paging-using-dynamics-365-webapi

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans