Hello - My system has a custom n:n relationship defined between case and contact. I'm trying to add a new row to the n:n table through a plugin but I'm getting an error. Here's a code snippet from the plugin:
foreach (var c in contacts)
{
var caseFinder = new AssociateRequest
{
Target = new EntityReference(new_case_finder.EntityLogicalName, parentId),
Relationship = new Relationship("new_CaseFinders"),
RelatedEntities = new EntityReferenceCollection
{
new EntityReference(Incident.EntityLogicalName, parentId),
new EntityReference(Contact.EntityLogicalName, c.Id)
}
};
service.Execute(caseFinder);
}
In the code above:
* "new_case_finder" is the name of the n:n table in the CRM database
* "new_CaseFinders" is the name of the relationship for which the new_case_finder table exists
Here's the error I'm getting on execute:
"The entity relationship role with id c5bb6639-81be-e211-a28d-00155d760004 either doesn't exist in or is not an association entity in relationship with id c2bb6639-81be-e211-a28d-00155d760004"
Any idea what I might be doing wrong here?
↧
trying to save n:n data through plugin?
↧