【问题标题】:Update composite fields like fullname,address更新全名、地址等复合字段
【发布时间】:2016-01-06 07:33:17
【问题描述】:

我不知道如何使用 c# 更新 ms crm 中的全名、地址等复合字段

if (dataRow[i].ToString() == string.Empty)
{
    selectedEntity["fullname"] = null;
}
else
{
    selectedEntity["fullname"] = "ms crm";
    //error
}

//it is not getting fullname in entity

【问题讨论】:

  • 如果您还有其他问题,请使用“”按钮而不是编辑您当前的帖子来询问其他问题。

标签: dynamics-crm-2011 dynamics-crm crm


【解决方案1】:

您不能直接设置复合字段的值。您需要设置基础字段(例如,设置 firstnamelastname 将更改联系人中 fullname 的值)。

以下来自 MSDN 的引用解释了这一点(尽管是在表单脚本的上下文中):

Although you can read the value of the composite value using getValue, you can’t use setValue to change the value of the composite attribute directly; you must set one or more of the attributes referenced by the composite attribute.

【讨论】:

  • 为此我们必须硬编码来识别和处理复合字段。 . 有什么动态方法可以做到这一点
  • 我不太关注你。在上面的示例中,您已经对字符串“fullname”进行了硬编码。随意提出一个新问题,详细说明您的具体情况。
  • 感谢 Henrik 的回复。 .我刚刚更新了问题。 .请通过它。
  • 我认为你需要解释你想要做什么。例如,在上面的代码中,您将 datarow[i] 映射到“selectedentity”的“fullname”。您如何查看 indata 以及为什么它有一个名为“fullname”的字段。 CRM 中确实没有那么多 Composite 字段,Contact 上的全名,systemuser 和我头顶的lead。您可以通过在 indata 中没有全名来绕过它。例如,我会说您在选项集方面面临更严峻的挑战。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-12-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-16
  • 2020-12-28
  • 1970-01-01
相关资源
最近更新 更多