You need to sign in to do that
Don't have an account?

NEXT_N_DAYS Query
I have a query where I want to use the NEXT_N_DAYS in my query but the problem is that the number of days is a variable in my code.
When I try writing as
Code:
Integer mydays = 20; Select Id from Opportunity where CloseDate = NEXT_N_DAYS:mydays
I get an error "Expecting a number, found mydays". I have tried the following variations but none of them work -
Code:
NEXT_N_DAYS::mydays NEXT_N_DAYS:mydays NEXT_N_DAYS: =:mydays
How do I do this?
Thanks,
Rohit
I don't have time to test this but try changing the variable in your code to a string.
Sorry I don't have time to test this.