简体   繁体   English

从Dynamics 365数据库中的FetchXml列中提取实体名称

[英]Extracting entity name from FetchXml columns in Dynamics 365 Database

I'm trying to write a SQL query that shows all Advanced Find views owned by a specific user in Dynamics 365 b8.2 (on-prem). 我正在尝试编写一个SQL查询,以显示Dynamics 365 b8.2(本地)中特定用户拥有的所有高级查找视图。

This is pretty straight-forward in terms of getting the view name, and User from the UserQuery view, but the entity related to that view is only stored as part of the FetchXML, so I need to extract that. 就获取视图名称和UserQuery视图中的User而言,这很简单,但是与该视图相关的实体仅存储为FetchXML的一部分,因此我需要提取它。

Can I use XPath on Fetch XML? 我可以在Fetch XML上使用XPath吗? Any help would be awesome! 任何帮助都是极好的! Two examples of the FetchXML are as follows (the entity is Account): 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>

FetchXml is valid XML so yes you can use xpath FetchXml是有效的XML,因此可以使用xpath

Something like /fetch/entity/@name should work. /fetch/entity/@name应该可以工作。 Views owned by Users should be ok, but be aware that there are some non-standard system views hidden away in the system 用户拥有的视图应该可以,但是请注意,系统中隐藏了一些非标准的系统视图

You can also include the returnedtypecode attribute/field from the userquery entity/table. 您还可以包括returnedtypecode从属性/场userquery实体/表。 That will return the objecttypecode of the entity that the view queries. 这将返回视图查询的实体的objecttypecode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM