我想使用 JavaScript 查找动态 crm 的所有实体 View 中设置的名称和列
。
实体的名称显示在上面的图像和 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/