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.
-
3Is 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.– Felix van HoveCommented Oct 4, 2022 at 19:30
-
1yes. thank you for the guide. Made a new comment– Ruchiran AvishkaCommented Oct 5, 2022 at 5:31
Add a comment
|
1 Answer
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: