javascript - 如何在 Dynamics crm 中使用 javascript 查找有关实体 View 的名称和信息

标签 javascript dynamics-crm crm dynamics-crm-2013

我想使用 JavaScript 查找动态 crm 的所有实体 View 中设置的名称和列

enter image description here

实体的名称显示在上面的图像和 View 中设置的列中。

最佳答案

“保存的查询”是保存与系统 View 相关的所有数据的实体。然而,获取列需要进行一些解析,因为“Grid”作为 xml 存储在实体的“LayoutXml”属性中。

例如获取“联系人”实体的 View :

O数据:

GET [Organization URI]/api/data/v8.0/savedqueries?$select=name,layoutxml&$filter=returnedtypecode eq 'contact'

FetchXml(使用 SDK.js 或 XrmServiceToolkit):

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="savedquery">
    <attribute name="name" />
    <attribute name="layoutxml" />
      <filter type="and">
        <condition operator="eq" attribute="returnedtypecode" value="2"/>
      </filter>
  </entity>
</fetch>

“事件联系人” View 的示例“LayoutXml”:

<grid name=\"resultset\" object=\"2\" jump=\"fullname\" select=\"1\" icon=\"1\" preview=\"1\"><row name=\"result\" id=\"contactid\"><cell name=\"fullname\" width=\"200\" /><cell name=\"telephone1\" width=\"100\" /><cell name=\"mobilephone\" width=\"100\" /><cell name=\"telephone2\" width=\"100\" /><cell name=\"fax\" width=\"100\" /><cell name=\"emailaddress1\" width=\"150\" /><cell name=\"address1_line1\" width=\"100\" /><cell name=\"address1_line2\" width=\"100\" /><cell name=\"address1_city\" width=\"100\" /><cell name=\"address1_postalcode\" width=\"100\" /><cell name=\"parentcustomerid\" width=\"150\" /></row></grid>

解析所有单元格元素的 xml,您将获得 View 列(例如):

<cell name=\"fullname\" width=\"200\" />
<cell name=\"telephone1\" width=\"100\" />

关于javascript - 如何在 Dynamics crm 中使用 javascript 查找有关实体 View 的名称和信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38990647/

相关文章:

javascript - 为什么我收到错误 : TypeError: "_co.form.submit is not a function"?

javascript - 这个 JavaScript 示例是否创建 “race conditions” ? (只要它们可以存在于 JavaScript 中)

typescript - 为 Dynamics CRM 编写可测试的 TypeScript 类

dynamics-crm - 在Dynamics CRM 2011中收取运费/运费的税

dynamics-crm-2011 - 如何在 CRM 2011 中向表单添加外部链接?

plugins - 如何迭代1 :N relationship in Dynamics CRM4 C# Plugin

javascript - 在 CRM 2011 Javascript 中获取架构名称

javascript - 是否有一个数据存储,我可以在其中拥有一个 json 计数器和增量将填充树?

javascript - Nice编辑点击问题

c# - Update-Plugin CRM 2011 上的前后实体图像