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
mahesh admin 3mahesh admin 3 

With the below code i am getting this error as [Compile Error: Illegal assignment from SOBJECT:Account to account at line 3 column 2]

trigger newoppurtunity on Account (after insert)

{
Account acc=Trigger.new[0];
Opportunity opp=new Opportunity();
opp.name=acc.name;
opp.stagename='yes';
opp.closedate=system.today();
opp.accountid=acc.id;
insert opp;
}
Vatsal KothariVatsal Kothari
You code is correct, its not giving any error.
Sagar PareekSagar Pareek
Can you try
Schema.Account acc=Trigger.New[0];