This error is because of wrong construction of Dynamic Query with Datetime. following code snippet will give idea on how to construct dynamic query for Datetime ?
1 | //format the datetime to make it Dynamic Soql ready |
2 | String formatedDt = cutOffDateTime.format('yyyy-MM-dd'T'HH:mm:ss'Z''); |
3 | String sql = 'SELECT a.Id FROM Agents_Answer__c a WHERE a.Agents_Test_Result__r.Agent_Name__r.IsActive__c = false AND LastModifiedDate < '+ formatedDt ; |
Where, “cutOffDateTime” is variable of datetime type.
No comments:
Post a Comment