You need to sign in to do that
Don't have an account?
F Smoak
check if datetime field has reached past today's datetime
I have to delete alerts whne expiration datetime has reached today's datetime
My expiration datetime is showing as 2019-10-05T00:00:00.000Z
I want to delete this record on 5th Oct but I am getting unknown error parsing query when I execute in query editor:
Select Id from Alert_vod__c where Expiration_Date_vod__c <= system.now()
Please help.
My expiration datetime is showing as 2019-10-05T00:00:00.000Z
I want to delete this record on 5th Oct but I am getting unknown error parsing query when I execute in query editor:
Select Id from Alert_vod__c where Expiration_Date_vod__c <= system.now()
Please help.
Select Id from Alert_vod__c where Expiration_Date_vod__c < 2019-10-06T00:00:00.000Z ( without quotes, problem of timezone nevertheless)
system.now() doesn't exist but you can use TODAY
Select Id from Alert_vod__c where Expiration_Date_vod__c <= TODAY
All Answers
Select Id from Alert_vod__c where Expiration_Date_vod__c < 2019-10-06T00:00:00.000Z ( without quotes, problem of timezone nevertheless)
system.now() doesn't exist but you can use TODAY
Select Id from Alert_vod__c where Expiration_Date_vod__c <= TODAY
can u pls check this question posted: https://developer.salesforce.com/forums/ForumsMain?id=9062I000000XkdDQAS
Greetings to you!
Use the below code.
DateTime currentTime = System.now();
List <Alert_vod__c> altList = new List <Alert_vod__c>();
altList = [Select Id, Expiration_Date_vods__c from Alert_vod__c WHERE Expiration_Date_vods__c <= : currentTime ];
System.debug('altList'+altList);
You can use the below link to know more
https://salesforce.stackexchange.com/questions/100187/how-to-compare-datetime-field-with-systemtime-now-in-soql-query
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com