Salesforce SOQLLin Dynamic query where clause

Link 1 alla documentazione ufficiale

Link 2 alla documentazione ufficiale

fieldExpression1 AND (fieldExpression2 OR fieldExpression3)
(fieldExpression1 AND fieldExpression2) OR fieldExpression3


List<Object__c> records = new List<Object__c>();

     String query = 'Select Id,..... from Object__c where id!=null';
    if (!string.isEmpty(fromDate))        
          query+='and fromDate=' fromDate;
	 if (!string.isEmpty(toDate))        
	 if (statuses.size()>0)        
     records = Database.query(query);

     return records;

Leave a Reply

en English
en Englishfr Frenchde Germanit Italian