Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Opportunity opp = new Opportunity(); opp.name = 'Test Opportunity'; opp.stageName = '1 Initial Sales Activity'; opp.CloseDate = System.today(); insert opp; Datetime yesterday = Datetime.now().addDays(-1); Test.setCreatedDate(opp.Id, yesterday);
try above code. I believe it will work.
don't forget to mark it as best answer.
Thank you