How do I associate an account to a contact using C#/SDK in Microsof Dynamics/CRM? RRS feed

  • Question

  • 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 (see this screenshot: hYYp://imgur.com/bigMptS. Please replace HYYp with http.) 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  (see this screenshot: hYYp://imgur.com/28QYMfr. Please reply hYYP with http.), 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

    Monday, June 16, 2014 7:42 AM

All replies

  • Hi,

    The second screenshot is that of Contact, not Account. Are you sure you're seeing the right entity?

    Admin QuikView Solution for CRM 2013

    Monday, June 16, 2014 7:46 AM
  • You need to use an entity reference in order to place information on a lookup field.

    EntityReference("contact", (GUID)contactId)

    Good Luck :)

    Monday, June 16, 2014 10:02 AM
  • Yes it is contact. As I said, the organization (i.e. Worksafe) appears on the contacts listing. But does not appear in the contail details.

    How can I make organization appear on the contact details? thanks

    Tuesday, June 17, 2014 12:49 AM
  • Hi,

    You want all the contacts to appear under Worksafe (account) in the Worksafe form in a subgrid, is it?

    Either way, when you're associating records using service.Associate() method, make sure you provide the correct relationship name. Otherwise, the association will occur but for a different relationship and won't appear where you want it to be.

    Admin QuikView Solution for CRM 2013

    Tuesday, June 17, 2014 4:40 AM
  • that's it. thanks a lot :)
    Wednesday, June 18, 2014 3:22 AM