You need to sign in to do that
Don't have an account?
S M
Using LAST_N_DAYS: with an Integer variable
I need to have a select Query in my Apex method that has this line -
AND Pending_Agreement_DateStamp__c <= LAST_N_DAYS:pendingDays
The pendingDays in an Integer value that is passed to this method
I tried using Sting.valueOf or Integer.valueOf but they dont seem to work. Please let me know what I should use there?
AND Pending_Agreement_DateStamp__c <= LAST_N_DAYS:pendingDays
The pendingDays in an Integer value that is passed to this method
I tried using Sting.valueOf or Integer.valueOf but they dont seem to work. Please let me know what I should use there?
I still get the error Missing INTEGER_LITERAL at startDate
and expecting a Number, found startDate as errors
Any work arounds?
Please go through with below formula, it may be helpful to you.
Date startDate = Date.today().addDays(-Integer.valueOf(numDays));
List<Account> accs = [select id from account where createddate >= :startDate];
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
Hi S M
You can use Database.query(soql) method instead of SOQL, no need to use '<= '. see code for details
please let me know if you are still facing any issue
Thanks,
Meer Zaman Khattak