
Hi everyone,
I'm trying to create an Acccount and ParentAccount by code. I wonder if you can help me with this:
********************
Account account = new Account();
account.Attributes.Add("name", "Example Account");
Account parentAccount = new Account();
parentAccount .Attributes.Add("name", "Example Parent Account");
EntityReference reference = new EntityReference();
EntityReference reference = new EntityReference(Account.EntityLogicalName, parentAccount.Id);
account.ParentAccountId = reference;
service.Create(account);
************
I noticed that parentAccount.Id as a value like 00-00-00...
Is that the good way to create an Account and his Parent Account related?
Thanks in advance for your response.
*This post is locked for comments
I have the same question (0)Yes right..you'll get guid of parent account only after its creation. So follow guido's code, its right.