【问题标题】:Creating Relationship between a lead and sales literature in Dynamics 365 CRM在 Dynamics 365 CRM 中创建潜在客户和销售文献之间的关系
【发布时间】:2020-05-05 07:35:53
【问题描述】:

我刚刚收到了对 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: '实体关系与 SchemaName = 'SalesLiterature_Lead' 在 元数据缓存'

我已经检查了Lead Entity ReferenceSales Literature Entity Reference,但没有找到此关系的架构名称。我错过了什么或者这是不可能的吗?

【问题讨论】:

  • 您确认了吗?

标签: c# dynamics-crm dynamics-365 dynamics-365-sales dynamics-crm-sdk


【解决方案1】:

我坚信您的屏幕截图中显示的“销售文学”是自定义活动实体,与 OOB“销售文学”实体不同。

可以使用此代码来创建一个带有regardingobjectid 潜在客户的自定义实体(活动)。只需将 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);

【讨论】:

  • 谢谢,这将创建一个任务实体并使用“关于对象 ID”属性将其与潜在客户关联,但我无法在 Microsoft 文档中找到可以与潜在客户关联的“销售文学”实体(活动)以同样的方式。
  • @MuhammadMuradHaider 没错,在我的第一个回答行中我说 - 这不是 OOB,可能是您环境中的自定义活动
【解决方案2】:

此错误向您表明您的关系名称错误,因此您应该找到正确的关系名称。因此您需要进行 CRM 自定义并在关系中的 SalesLiterature 实体下找到正确的架构名称

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 1970-01-01
    • 2019-06-16
    • 2017-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多