Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
superbadge_process_automation_opportunity_automation
Account a = new Account(name='Astro Chicken & Ribs Joint', BillingState='NY', ShippingState='NY', Type='Customer - Channel');
insert a;
Opportunity opp = new Opportunity(AccountId=a.Id,Name='Sell some chicken salad', StageName='Closed Won', Amount=99999, CloseDate=Date.today());
insert opp;
// ensure the flow ran successfully
System.assertEquals(1, [select count() from Robot_Setup__c where Opportunity__c = :opp.Id]);
// check the date
List<Robot_Setup__c> rs = [select id, date__c from Robot_Setup__c where Opportunity__c = :opp.Id limit 1];
System.assert(Date.today().daysBetween(rs[0].Date__c) >= 179);
// update so we can delete the opp
opp.StageName = 'Prospecting';
update opp;
// clean up
delete a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.