You need to sign in to do that
Don't have an account?

How to link Contact with Account
I don't know what I am doing wrong. I am try to create a Contact, then link it with an Account. Here is the gist of it.
Account a = new Account();
a.Name = 'account1';
insert a;
Contact c = new Contact();
c.Account__c = a; // is this the right way to link them together?
insert c;
Contact cc = [ select name, Account.Name from Contact ];
System.debug(cc.Account); // Account is null here. Why?
Much appreciated if someone figures this out. I am stumped.
Hi,
Hope the below code helps!!
Regards
Sameer