locked
Programmatically link between Contact and custom entity. RRS feed

  • Question

  • On Post Create of a contact, the system need to create a record in another entity, say limitedInfo, and links between to two entity.
    May I know how do I do that?

    All I can think of is the create new record in limitedInfo, assign the contact lookup, and in contact lookup, update the limitedinfor lookup,
    but how can i get the newly created limited info lookup and guid?

    Monday, October 12, 2009 8:08 AM

Answers

  • Hi.

    To receive identifier of newly created contact you can use following statement:

    Guid contactId = (Guid)context.OutputParameters["id"];

    When you are creating some entity using crm webservices you can retrieve entity id using following code:

    Guid entityId = crmservice.Create(entity);
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, October 12, 2009 8:14 AM
    Moderator
  • Hi.

    Because in N:N relation you can't add new fields to those 'middle' entity.
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, October 12, 2009 8:42 AM
    Moderator

All replies

  • Hi.

    To receive identifier of newly created contact you can use following statement:

    Guid contactId = (Guid)context.OutputParameters["id"];

    When you are creating some entity using crm webservices you can retrieve entity id using following code:

    Guid entityId = crmservice.Create(entity);
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, October 12, 2009 8:14 AM
    Moderator
  • thanks andriy. will give it a try.

    another question, i read some thread you mentioned that there can have 1:N and N:1 between two entity.

    why are they different from N:N relationship?
    Monday, October 12, 2009 8:34 AM
  • Hi.

    Because in N:N relation you can't add new fields to those 'middle' entity.
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Monday, October 12, 2009 8:42 AM
    Moderator