문제

We have email list builder in our Salesforce app. User specifies filter criteria for Contact sObject and builder generates SOQL query which then will be used to pull unique emails by external service via API. The need is to display number of unique emails in Salesforce UI before the user launches the Email Campaign through the external service.

도움이 되었습니까?

해결책

You can use the @ReadOnly annotation to increase the limit of queries. This is documented here - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_ReadOnly.htm. The down side of this is you can't carry out any DML operations and it must be used to annotate a Web Service or Schedulable implementation.

You can also use database.query(query) which creates the query at run time (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Database_query.htm) like this (untested) :

AggregateResult results = database.query('SELECT COUNT(id) count FROM sObject');
Integer count = results.get('result');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top