【问题标题】:MS CRM 4.0. FetchXML return columns even if empty微软客户关系管理 4.0。即使为空,FetchXML 也会返回列
【发布时间】:2009-07-27 11:28:35
【问题描述】:

因此,如果 CRM 中没有为它保存数据,使用 FetchXML 似乎不会返回列。

例如:

<fetch mapping="logical" count="50">
<entity name="contact">
    <attribute name="contactid" />
    <attribute name="emailaddress1" />
    <attribute name="firstname" />
    <attribute name="jobtitle" />
    <attribute name="lastname" />
    <attribute name="mobilephone" />
    <attribute name="parentcustomerid" />
    <attribute name="telephone1" />
    <filter>
        <condition attribute="parentcustomerid" operator="eq" value="94bf630f-b364-de11-8f1d-001cc02e75b4" />
    </filter>
</entity>

但是返回的XML如下

<resultset morerecords="0" paging-cookie="&lt;cookie page=&quot;1&quot;&gt;&lt;contactid last=&quot;{86805DB5-E06B-DE11-81EE-001CC02E75B4}&quot; first=&quot;{7CBC9B9A-E06B-DE11-81EE-001CC02E75B4}&quot; /&gt;&lt;/cookie&gt;">
<result>
    <contactid>{7CBC9B9A-E06B-DE11-81EE-001CC02E75B4}</contactid>
    <emailaddress1>tom@xxx.org.uk</emailaddress1>
    <firstname>tommy</firstname>
    <jobtitle>Dude</jobtitle>
    <lastname>Smith</lastname>
    <parentcustomerid yomi="" name="Tom's bike shoppe" dsc="0" type="1">{94BF630F-B364-DE11-8F1D-001CC02E75B4}</parentcustomerid>
</result>
<result>
    <contactid>{86805DB5-E06B-DE11-81EE-001CC02E75B4}</contactid>
    <emailaddress1>jason@xxx.org.uk</emailaddress1>
    <firstname>jason</firstname>
    <lastname>Finch</lastname>
    <parentcustomerid yomi="" name="Tom's bike shoppe" dsc="0" type="1">{94BF630F-B364-DE11-8F1D-001CC02E75B4}</parentcustomerid>
</result>

例如,第二条记录没有职称,并且两条记录都没有手机号码。这使得将这些绑定到数据控件变得很棘手。

所以基本上我的问题是,是否可以强制 CRM 以空白或空值返回这些字段?

【问题讨论】:

    标签: xml dynamics-crm dynamics-crm-4


    【解决方案1】:

    简而言之,没有。

    我不知道您的绑定情况的具体情况,但是您是否可以只使用一个自定义模型类来填充您的提取结果,然后绑定到该模型类而不是绑定到 XML?

    【讨论】:

    • 我确实最终选择了这条路线并添加了所需的列,如果它们没有在 fetch 中返回。
    【解决方案2】:

    另一种选择是不使用 API 的 FetchXML 部分,而是使用 RetrieveMultiple 获取强类型的 BusinessEntity 记录。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-11
      • 1970-01-01
      • 1970-01-01
      • 2014-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多