0
votes

Hello.

I have sort of associated an account to a contact using C#/SDK. I used the parentcustomerid attribute on the contact entity. If I go the CRM website (click this link) and look up all the active contacts under my name, it is showing the acct under organization. But when I click on the acct and want to view the details  (click this link), I cannot see any reference to the organization listed in the list.

I also manually created a new contact using the Dynamics website (i.e. not SDK) and I can't find a way on entering a relationship.

Any ideas on how to do it via C# and via the website?

Thanks very much

1
What is the organization field on the contact. It should be a lookupDot_NET Pro

1 Answers

0
votes

for two entities to be linked to each other in CRM 2011. A field of type lookup is used to make relationship.

for example:

We want to associate account to contact. So that each contact will be in an account. or there will be a parent account of each contact.

So here are the steps in CRM 2011 Dynamics Website:

  1. Go the contact formeditor
  2. Click on New Field
  3. Select Lookup in Type
  4. Target record type 'Account'
  5. Save and Close

Now Open any existing contact, you will find a new Lookup field on the contact, click and select any Account. A relationship will be created between them.

In C# to create a new contact to be linked to account, below is the following code:

 Entity Contact_To_Be_Created = new Entity("contact");
 Contact_To_Be_Created.Attributes.Add("your_lookup_name",new EntityReference("account",GUID_of_the_account_you want to link));
 Service.create(Contact_To_Be_Created );