Good day everyone,
I have installed an npsp package and then I created a visual force that will save a new affiliation . I've tried to used an external Id to save the data. I've already tried saving data using external Id in account and contact. But when I tried in npsp affiliation I've encounter some problem "Illegal assignment from Account to Id". What am I missing ? Below is my sample code. Please help. Thanks.
npe5__Affiliation__c aff = new npe5__Affiliation__c(); Account accReference = new Account(); accReference.DI_extId__c = 'acc_12345'; aff.npe5__Organization__c = accReference; Contact conReference = new Contact(); conReference.DI_extId__c = 'con_12345'; aff.npe5__Contact__c = conReference; Account accountList = new Account(); accountList.Name = 'TEST ACCOUNT 1'; accountList.DI_extId__c = 'acc_12345'; Contact contactList = new Contact(); contactList.Last = 'TEST CONTACT 1'; contactList.DI_extId__c = 'con_12345'; Insert accountList; Insert contactList; Insert aff;