You need to sign in to do that
Don't have an account?
moeoo
Create Contact object by passing existing Account object
I'm trying to create a contact object and I want to attach the existing account object.
The code I've written is
private Account m_Account = null; //Salesforce account (build-in Account object)
Contact objContact = new Contact();
objContact.FirstName = m_FirstName;
objContact.LastName = m_LastName;
objContact.Phone = m_Phone;
objContact.Account = m_Account;
After I assign the contact.Account, I'm getting following error and contact object is not created.
More than 1 field provided in an external foreign key reference in entity: Account
I hope I'm doing the right thing here. If not, is there any way I can create a Contact object using existing Account Object.
Thanks in advance
Superfell
objContact.AccountId = m_Account.Id
moeoo
Thanks a lot. It works!!:smileyvery-happy: