I'm trying to associate a center with a contact. There exists a many to many relationship between contact and center named "tle_contact_tle_center";
I tried the following two ways to achieve this but none of them worked.
Any help in this regard would be appreciated.
1)
AssociateRequest request = new AssociateRequest { Target = new EntityReference("contact", contactId), Relationship = new Relationship("tle_contact_tle_center"), RelatedEntities = new EntityReferenceCollection { new EntityReference("tle_center",centerId) } }; service.Execute(request);
2)
EntityReferenceCollection relatedEntities = new EntityReferenceCollection(); relatedEntities.Add(new EntityReference("tle_center", centerId)); // Create an object that defines the relationship between the contact and center. Relationship relationship = new Relationship("tle_contact_tle_center"); //Associate the center with the contact service.Associate("contact", contactId, relationship, relatedEntities);
*This post is locked for comments
Sorry for posting the question. The code is working but I forgot to enable the plugin step.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156