[英]Creating Relationship between a lead and sales literature in Dynamics 365 CRM
我刚收到 asp.net webforms 应用程序的需求,它必须与 MS Dynamics 365 CRM 集成。 我从来没有为 Dynamics 365 做过开发,但无论如何我已经设法使用 .net sdk 连接到 CRM 并创建了一个潜在客户和销售文献实体。 我的意图是通过转到Dynamics 365 portal --> Lead --> related --> Activities--> Sales Literature
来实现我们可以做的事情:
因此,我想使用 .net sdk 建立这两个实体(潜在客户和销售文献)之间的关系,这是我的代码:
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);
但是代码无法在CRMService.Execute(association);
说:
System.ServiceModel.FaultException`1:“在 MetadataCache 中找不到与 SchemaName = 'SalesLiterature_Lead' 的实体关系”
我坚信您的屏幕截图中显示的“销售文学”是一个自定义活动实体,它与 OOB“销售文学”实体不同。
可以使用此代码来创建一个自定义实体(活动),并将其作为regardingobjectid
objectid 的潜在客户。 只需将task
替换为您的实体名称
Entity followup = new Entity("task");
followup["subject"] = "Sample task - an activity";
followup["description"] = "Sample description";
followup["scheduledstart"] = DateTime.Now;
followup["scheduledend"] = DateTime.Now.AddDays(2);
Guid regardingobjectid = new Guid("26ADDD07-D9F4-E711-8138-E0071B715B11"); //leadid
string regardingobjectidType = "lead";
followup["regardingobjectid"] = new EntityReference(regadingobjectidType,regardingobjectid);
// Create the followup activity
CRMService.Create(followup);
此错误向您表明您的关系名称错误,因此您应该找到正确的关系名称。因此您需要 go CRM 自定义并在关系中的 SalesLiterature 实体下找到正确的架构名称
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.