New Batch#100 (10th Nov 2021) - Salesforce Admin + Dev Training (WhatsApp: +91 - 8087988044) :https://t.co/p4F3oeQagK

Saturday 11 August 2012

Illegal assignment from LIST to LIST

* If there is any apex class with the same name of the standard or global sObjects while creating List, map,set the above error will reflect.
*We can solve this problem in two ways:
1. We have to rename our Apex Class to some other name.
2. Use 'Schema' before sObject while creating List, Set, Map (Don't use 'schema' before sObject in SOQL Query)
- List<Schema.Account> aclist = new List<Schema.Account>();
- return type should be also like List<Schema.Account>
-Click here to see the example here!

Refer:
 Illegal assignment from LIST<Account> to LIST<Account>

1 comment:

  1. public class majormarkete {
    mudi__DmList__c[] selecta;
    public mudi__DmList__c[] getselecta(){
    return selecta;
    }
    public PageReference show(){
    selecta=[SELECT COUNT(Name) FROM mudi__DmList__c];
    return null;
    }
    public PageReference showspec(){
    selecta=[select mudi__Name__c,mudi__Email__c from mudi__DmList__c ];
    return null;
    }

    }
    what should i do same proble here

    ReplyDelete

Labels