【问题标题】:Extracting entity name from FetchXml columns in Dynamics 365 Database从 Dynamics 365 数据库中的 FetchXml 列中提取实体名称
【发布时间】:2018-08-23 03:15:49
【问题描述】:

我正在尝试编写一个 SQL 查询,以显示 Dynamics 365 b8.2(本地)中特定用户拥有的所有高级查找视图。

这在从 UserQuery 视图中获取视图名称和用户方面非常简单,但与该视图相关的实体仅作为 FetchXML 的一部分存储,因此我需要提取它。

我可以在 Fetch XML 上使用 XPath 吗?任何帮助都是极好的! FetchXML的两个例子如下(实体为Account):

<fetch mapping="logical" version="1.0" distinct="false" output-format="xml-platform">
  <entity name="account">
    <attribute name="name" />
    <attribute name="primarycontactid" />
    <attribute name="telephone1" />
    <attribute name="address2_city" />
    <attribute name="parentaccountid" />
    <attribute name="new_navnumber" />
    <attribute name="emailaddress1" />
    <attribute name="new_accountmanager" />
    <attribute name="accountclassificationcode" />
    <attribute name="accountid" />
    <order descending="false" attribute="name" />
    <filter type="and">
      <condition value="0" attribute="statecode" operator="eq" />
      <condition value="1" attribute="new_isshareholder" operator="eq" />
      <condition attribute="accountclassificationcode" operator="in">
        <value>200001</value>
        <value>200003</value>
        <value>200005</value>
        <value>200007</value>
        <value>200009</value>
        <value>200011</value>
        <value>100000000</value>
        <value>200012</value>
      </condition>
    </filter>
  </entity>
</fetch>

【问题讨论】:

    标签: sql-server tsql fetchxml dynamics-365


    【解决方案1】:

    FetchXml 是有效的 XML,所以可以使用 xpath

    /fetch/entity/@name 之类的东西应该可以工作。用户拥有的视图应该没问题,但请注意系统中隐藏了一些非标准的系统视图

    【讨论】:

      【解决方案2】:

      您还可以包含userquery 实体/表中的returnedtypecode 属性/字段。这将返回视图查询的实体的objecttypecode

      【讨论】:

        猜你喜欢
        • 2021-01-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-12-07
        相关资源
        最近更新 更多