Salesforce - query returns only 500 rows when more exist

落花浮王杯 提交于 2019-12-23 12:23:16

问题


First of all, I'm not the one developing this but I'm the one with the SO account. My SF knowledge is almost non-existent.

Basically, the problem is that a query is returning only 500 rows from our PHP script. However when we substitute that query (directly within the PHP) with another, that query returns over 1500 rows. There are definitely over 500 rows that ought to be returned by the first query - I've checked using the data explorer.

Here's the first query:

SELECT Id,WEBSITE_ExternalId__c,Name,
.............
from Account

And here is the second:

SELECT Id,WEBSITE_ExternalId__c,D_STANDARD_Age__c,
..............
from Feedback__c 
ORDER BY CreatedDate ASC

Any clues? I appreciate this might not be enough information but I don't know much about Salesforce. If there's anything else you'd need to answer this, ask and I'll see what I can do.


回答1:


For large results, the results are batched by the query call, you'll get so many rows, along with a token you can use to fetch the next batch and so on. there's an done flag in the query result, that indicates if this is the last batch in the results or not. if done is false you need to call queryMore passing in the queryLocator (also returned in the queryResult structure). See the docs/examples on query/queryMore.




回答2:


Make sure you are using the latest WSDL from Setup > Develop > API, and make sure WSDL cacheing is disabled in your PHP settings: https://help.salesforce.com/apex/HTViewSolution?id=786331&language=en.

Also as mentioned in the guide, 500 results is the default for query objects. In addition to using queryMore() for larger calls, see here for documentation on setting the batch size: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_changing_batch_size.htm.



来源:https://stackoverflow.com/questions/7271294/salesforce-query-returns-only-500-rows-when-more-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!