You need to sign in to do that
Don't have an account?
user23232323
System.now in Dynamic SOQL
Hi,
I could use some assistance with an apex error Im receiving from a batch process. Im trying to filter my batch using System.now() but am getting an unexpected token: "(' error from the getQueryLocator line. How do I get System.now() to translate properly so the query will execute? Thanks ahead of time.
I could use some assistance with an apex error Im receiving from a batch process. Im trying to filter my batch using System.now() but am getting an unexpected token: "(' error from the getQueryLocator line. How do I get System.now() to translate properly so the query will execute? Thanks ahead of time.
global class BatchTempName implements Database.Batchable<sObject>, Database.Stateful { String query = ''; global BatchTempName() { query = 'SELECT Name,Custom_Date_Time__c, Unavailable__c FROM User where Custom_Date_Time__c <: System.now() and Unavailable__c = true'; } global Database.QueryLocator start(Database.BatchableContext BC) { return Database.getQueryLocator(query); } ... }
Refer this link
https://salesforce.stackexchange.com/questions/100187/how-to-compare-datetime-field-with-systemtime-now-in-soql-query
All Answers
Refer this link
https://salesforce.stackexchange.com/questions/100187/how-to-compare-datetime-field-with-systemtime-now-in-soql-query
Please note, it is not '<:', just '<'