+ Start a Discussion
m pandeym pandey 

Illegal assignment from Map<Id,Contact> to Map<Id,Account>

trigger newacconsal on Contact (after insert) {
    set<Id> ids=new set<Id>();
    
    map<id,Account> macc=new map<id,Account>();
    map<id,Contact> mcon=new map<id,Contact>();
    
        map<id,Account> macc=trigger.old;

}


Error

Illegal assignment from Map<Id,Contact> to Map<Id,Account>
sfdcMonkey.comsfdcMonkey.com
hi pandey
use below code 

trigger newacconsal on Contact (after insert) {
    set<Id> ids=new set<Id>();
    
    map<id,Contact> mcon=new map<id,Contact>();
    map<id,Account> macc=new map<id,Contact>();
    
        mcon=Trigger.newMap;

}

we can not assign contact map to account map in contact trigger .

Thanks 
mark it slove if it work for you :)
 
m pandeym pandey
error
Illegal assignment from Map<Id,Account> to Map<Id,Contact>
sfdcMonkey.comsfdcMonkey.com
try it 
trigger newacconsal on Contact (after insert) {
    set<Id> ids=new set<Id>();
    
    map<id,Contact> mcon=new map<id,Contact>();
    map<id,Account> macc=new map<id,Account>();
    
        mcon=Trigger.newMap;

}

my bad :)
Thanks 
m pandeym pandey
Illegal assignment from Map<Id,Account> to Map<Id,Contact>
 
vishnu Rvishnu R
hi pandey.
 try this

trigger newacconsal on Contact (after insert) {
set<Id> ids=new set<Id>() ;
map<id,Account> macc=new map<id,Account>();
map<id,Contact> mcon=new map<id,Contact>();
map<id,Contact> macc=trigger.old;
}
m pandeym pandey
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000XbA4QAK