I'm allowing a user to upload multiple files for accounts, contacts, and trades. Contact looks up to Accounts via a lookup field while trades look up to accounts via a master-detail relationship.
I've been able to insert both accounts and contacts successfully, but I'm running into issues inserting trades.
I'm inserting contacts that look up to accounts using:
tempContact.Account = new Account(MasterID__c=inputValuesContact[7]); (no issues)
and similarily trying to insert trades with:
tempTrade.Account__c= new Account(MasterID__c=inputvaluesTrade[0]);
For trades I'm getting the error: Illegal assignment from Account to Id.
Am I missing something obvious? I've tried inserting with tempTrade.Account__r.Name but received a similar error: Illegal assignment from String to Id.
Best Answer
__c
always refers to the Id, which is similar toAccountId
. Using__r
is the similar to usingAccount
(by contrast):