0

net.query limits 200 records at a time. Where large number of records are not retrieving and does not even display an error but outputting response.done = false and response.nextRecordsUrl has a url value as all the data not retrieved in the response.

2
  • 3
    Is this a question and an answer in one? If so, please cut down your text to be a proper question and post your answer as an explicit StackExchange answer below. It's possible and improves readability. Commented Oct 4, 2022 at 19:30
  • 1
    yes. thank you for the guide. Made a new comment Commented Oct 5, 2022 at 5:31

1 Answer 1

0

net.query only retrieve 200 records at a time. using net.querymore with nextRecordsURL to retrieve all the large data.

    var AllQueryData = []
        net.query(
          query,
          async (res) => {
            AllQueryData = [...res.records]
            var querystatus = res.done
            var nexturl = res.nextRecordsUrl

            while(!querystatus){ // getting bulk updates if rec <200 using querymore
              var url = 'https://MyDomainName.my.salesforce.com' +nexturl
             var queryy =  queryMoreData(url,soupName,idPath)
              await saveInSoup(queryy.records, soupName, idPath);
               querystatus = queryy.done
               nexturl = queryy.nextRecordsUrl
              AllQueryData = [...AllQueryData, ...queryy.records]
            }
// save in soup or do anything with AllQueryData as it has all data more than 200 records

            resolve(tempArray);
          },
          (err) => {
            reject(err);
          }
        );
      });
      export const queryMoreData = (url) =>
      new Promise((resolve, reject) => {
      net.queryMore(url,
        async(ress) => {
            resolve(ress)
        }, (err)=>
          reject(err)
     )

ref links:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .