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
sultansultan 

what does the Error mean "Illegal assignment from LIST<Account> to LIST<Account>"

AshlekhAshlekh
Hi,

If you can provide your code then It helps us to give you best answer. But there is not any problem to assing a list of account to a list of account.
Shyam BhundiaShyam Bhundia
Do you have a class named "Account" in your org?  If you do then thats your issue, its causing a conflict.
sultansultan
Hi Ashlekh.

Plz check the code below:

public class durga
{
list<account> alist=new list<account>();
list<Account> a=[select id,name,industry from account];
public void m12()
{
for(account acc:a)
{
acc.name='jaffa';
acc.industry='jaffa industry';
alist.add(acc);
}
update alist;
}
}
AshlekhAshlekh
Hi,

There is no any error. And this code is running successfully in my org.
Shyam BhundiaShyam Bhundia
As from my previous comment, can you tell us if you have a class called Account in your org?
If you do, then prefix all the places (apart from the soql) where you want to refer to the Account object with Schema.Account.

public class durga{
    list<Schema.Account> alist=new list<Schema.Account>();
    list<Schema.Account> a=[select id,name,industry from Account];
    public void m12(){
      for(Schema.Account acc:a){
	 acc.name='jaffa';
	 acc.industry='jaffa industry';
	 alist.add(acc);
      }
      update alist; 
    }
}


Bhawani SharmaBhawani Sharma
As Shayam said, I am sure you have a class name Acccount in your org. Best would be to update the className to something else or user the Schema.Account.