Is there anyway I can use a variable value for LAST_N_DAYS. For example, I am trying to do something like:
Integer lastDays = 7; //... //... List<Opportunity> opportunities = [SELECT OwnerId, Amount, Probability FROM OPPORTUNITY where Amount > 0 and LastModifiedDate < LAST_N_DAYS:lastDays];
But I get:
expecting a number, found 'lastDays'