You need to sign in to do that
Don't have an account?
Jerry Xu 1
How to return all accounts (not just 1000)?
Hi,
Really new to salesforce, so sorry if this question is too easy to you.
I downloaded the ForceToolkit.et and use that to do a query. My requirement is to grab all the accounts from my company's SaleForce hosting and sync some fields with local db.
This is what I am doing:
ForceClient fclient = new ForceClient(client.InstanceUrl,
client.AccessToken, client.ApiVersion);
var accounts =fclient.QueryAsync<Account>("SELECT id, name, description FROM Account");
My company has more than 1000 accounts in SaleForce, and above query always return exactly 1000. Is there a way to return every record?
Many Thanks
Really new to salesforce, so sorry if this question is too easy to you.
I downloaded the ForceToolkit.et and use that to do a query. My requirement is to grab all the accounts from my company's SaleForce hosting and sync some fields with local db.
This is what I am doing:
ForceClient fclient = new ForceClient(client.InstanceUrl,
client.AccessToken, client.ApiVersion);
var accounts =fclient.QueryAsync<Account>("SELECT id, name, description FROM Account");
My company has more than 1000 accounts in SaleForce, and above query always return exactly 1000. Is there a way to return every record?
Many Thanks
You cn get upto 50000 records but if you want to get more than that you may need to use batch apex.
Please have a look at the below doc link and let me know for any clarification.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_ReadOnly.htm
Regards,
BDatla
The thing is it always just return 1000 exactly. I tried to enlarge it:
var accounts =fclient.QueryAsync<Account>("SELECT id, name, description FROM Account limit 300000");
Still it only returns 1000 record.
I checked the details of the return. Apparently the return is:
{"totalSize":3662,
"done":false,
"nextRecordsUrl":"/services/data/v32.0/query/01g24000001p2XAAAY-1000"
,"records":[{"attributes":{"type":"Account","url":"/services/data/v32.0/sobjects/Account/00124000004DY0FAAW"}
,"Id":"00124000004DY0FAAW","Name":"Triangle 3","Description":null},
................
}
So can do I use NextRecordsUrl to get data?
Many Thanks
I think the batch size is 1000 that why it is getting only 1000 records.
Yes, You can use NextRecordsUrl
the below article may help you to better understand this functionality.
https://developer.salesforce.com/blogs/developer-relations/2014/10/nothing-but-dotnet-querying-objects-new-force-com-toolkit-net.html
Regards,
BDatla
Can you please let me know the reason and my answers anyway helped ?
Regards,
BDatla