Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Xrm.WebApi.retrieveMultipleRecords() does not work on button click in htmlweb resource

I have html webresource and js file that searches and shows record in popup. The following code works fine on page load but Xrm.WebApi.retrieveMultipleRecords() would not work on button click. Please advise whats goin on.

<div>
   <a> Enter Search String </a>
   <input type="text" id="searchstring">
   <button class="pure-button" onclick="btnClick();">Go</button>
</div>
document.addEventListener('DOMContentLoaded', function () {
    // code only gives information if i call btnClick() here
    //btnClick();
}

function btnClick() {
    Xrm.WebApi.retrieveMultipleRecords("account", "?$select=name&$top=3").then(
        function success(result) {
            for (var i = 0; i < result.entities.length; i++) {
                console.log(result.entities[i]);
            }                    
            // perform additional operations on retrieved records
        },
        function (error) {
            console.log(error.message);
            // handle error conditions
        }
    );
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

All right answer to that question is simple. add type="button" in html of button

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!