Play Games

Search This Blog

Tuesday, June 13, 2017

How to fetch/query an object records created today in dynamic SOQL salesforce

How to fetch/query an object records created today in dynamic SOQL salesforce

Solution:
string query = 'select id,name from Lead where createddate=TODAY';
List<Lead> lstLead = new List<Lead>();
lstLead = Database.query(query);
system.debug('List of Leads:'+lstLead);
Output:

In Batch Apex:
public string query = 'select id,name from Lead where createddate=TODAY';
global database.querylocator start(Database.BatchableContext BC) {
return Database.getQueryLocator(query);
}

No comments:

Post a Comment