I just got a requirement for asp.net webforms app, which has to integrate with MS Dynamics 365 CRM. I have never done dev for Dynamics 365 but anyhow I've managed to connect with CRM using .net sdk and created a Lead and Sales Literature entity. My intent is to achieve what we can do by going to Dynamics 365 portal --> Lead --> related --> Activities--> Sales Literature
:
So, I want to establish relationship between these two entities (lead and sales literature) using .net sdk, here is my code:
AssociateRequest association = new AssociateRequest
{
Target = new EntityReference(leadEntity.LogicalName, leadid),
RelatedEntities = new EntityReferenceCollection
{
new EntityReference(SLEntity.LogicalName, SLID)
},
Relationship = new Relationship("Lead_SalesLiterature"),
RequestId = new Guid()
};
// Execute the request.
CRMService.Execute(association);
But the code fails to establish the relationship on CRMService.Execute(association);
saying that:
System.ServiceModel.FaultException`1: 'The Entity Relationship with SchemaName = 'SalesLiterature_Lead' was not found in the MetadataCache'
I have checked both Lead Entity Reference and Sales Literature Entity Reference but not finding Schema name for this relationship. Am I missing something or this is not possible?
this error show to you that your relation name is wrong so you should find correct relation name.so you need to go CRM customization and under the SalesLiterature entity in relationships find correct schema name