简体   繁体   中英

Associate contact entity to multiple entities using Web API- Dynamics CRM

I am needing to associate contacts entity to multiple studios(studios is a custom entity). I am using a lookup field in contacts entity, contact.studioid to do the same.

I am able to associate initially then replace Studio associations using Web API using this contact["studioid_odata.bind"] = "/studios(GUID)" line in my Web API JSON body which works well to replace the studio.

I would like to know how to associate a new studio to the contact on each call, without replacing it.

If entity is custom then it will have some prefix on the start like "new_". Anyway my recommendation is to use CRMRestBuilder to build your request - https://github.com/jlattimer/CRMRESTBuilder/releases/tag/2.6.0.0

If the Contact has a studioid then your relationship is the wrong way round as this means that a Contact can only have a single studio

You need to create another relationship between the contact and studio entities. Depending on your requirements, this can be (from the Contact record) a

  • A 1:N Relationship; or
  • An N:N Relationship

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM