function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amith RaoAmith Rao 

trigger checkboxupdate on Opportunity (Before insert, before Update) {if(trigger.isInsert) {for(Opportunity acc:trigger.new) {acc.IsPrivate=True;} }}

trigger checkboxupdate on Opportunity (Before insert, before Update)  
{if(trigger.isInsert)    
   {for(Opportunity acc:trigger.new)    
        {acc.IsPrivate=True;}
 }}

Whats the code to execute in Anonymous window.? I get error in below Excution. Please suggest

Opportunity acc = new Opportunity(String Name='TrigOrangesCTRL', Date CloseDate='12/17/2017', String StageName='Prospecting');
insert acc;
Best Answer chosen by Amith Rao
v varaprasadv varaprasad
Hi Amith,

Please use below code : 
 
Opportunity acc = new Opportunity(Name='TrigOrangesCTRL',CloseDate=system.today(),StageName='Prospecting');
insert acc;

Thanks
Varaprasad




 

All Answers

v varaprasadv varaprasad
Hi Amith,

Please use below code : 
 
Opportunity acc = new Opportunity(Name='TrigOrangesCTRL',CloseDate=system.today(),StageName='Prospecting');
insert acc;

Thanks
Varaprasad




 
This was selected as the best answer
Santosh Kumar SantSantosh Kumar Sant
 
Opportunity opp = new Opportunity 
(Name='TrigOrangesCTRL', CloseDate=Date.today() + 5, StageName='Prospecting');
insert acc;

 
Amith RaoAmith Rao
Thank you VaraPrasad.

Thankyou Santosh.      Both  System.today()  or  Date.today() worked well. 

Let me know if you can share your mail Id or Linked in to get in touch.

Regards
Amith S Rao
watsapp: 9620588065
v varaprasadv varaprasad
Hi Amith,

Above answer helps you, please mark it as the best answer.
If you need any help Please let me know.
varaprasad4sfdc@gmail.com


Thanks
Varaprasad