質問

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