当前位置:网站首页>Dynamics crm: use setfilterxml to filter the records that need to be displayed in the subgrid control of the form
Dynamics crm: use setfilterxml to filter the records that need to be displayed in the subgrid control of the form
2022-07-22 07:32:00 【Stone-hdj】
We often use... In forms subgrid Control , Usually insert... In a form subgrid Used to display records in another entity , The displayed content is displayed by defining different views , It can also be done through javascript To do some control .
In today's blog post, we use another method to achieve flexible in subgrid Up to display customized records , That's what we need today setFilterXml.
Note: It needs to be explained in advance , This setFilterXml It doesn't appear in Microsoft's official documents , So I'm not sure which versions support , Which versions do not support , What I tried was Dynamics 365 9.0 On-premises and Dynamcis 365 9.2 online These two versions .
The following is an example , We are in the entity contact Has been inserted into the form Account The entity's Subgrid
And then we open up contact After a record of , Will see Account Of subgrid Control Account
open F12 Browser debug mode for , First get this Subgrid Control
var subgrid = Xrm.Page.getControl("AccountsSubgridTest")
Through this control, we can view its existing filter
subgrid.getFetchXml()
For example, we just want to subgrid It shows that Account Name by A All the records at the beginning , So we use the advanced search function to put this FetchXML download .
But notice that we need to replace the double quotation marks inside with the single quotation marks , And as long as filter Content in Tags .
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='account'>
<attribute name='name' />
<attribute name='primarycontactid' />
<attribute name='telephone1' />
<attribute name='accountid' />
<order attribute='name' descending='false' />
<filter type='and'>
<condition attribute='name' operator='like' value='A%' />
</filter>
</entity>
</fetch>
That is to say
<filter type='and'><condition attribute='name' operator='like' value='A%' /></filter>
Then run the following code to set this subgrid Of filter
subgrid.setFilterXml("<filter type='and'><condition attribute='name' operator='like' value='A%' /></filter>");
Last refresh
subgrid.refresh();
Finally, we can see the display effect
Usually we can use setFilterXml This method is onload Event to realize the custom function of displaying records , It will have a higher degree of freedom than we use the filter conditions in the view , And you can display different records according to different conditions in your code , To achieve the effect we want .
边栏推荐
- Template implementation of linked list
- 80.26亿元!国家互联网信息办公室对滴滴依法作出网络安全审查相关行政处罚
- 主机psql连接虚拟机Oracle
- The difference between abstract class and interface interface in C #
- Dynamics 365: 查找哪些记录使用Access Team这种方式分享给了某一个User
- 码蹄集 - MT2095 · 曲径折跃
- 益盟操盘手软件可靠么?买股票安全吗?
- 2022/7/18 cf训练
- Keras深度学习实战(15)——从零开始实现YOLO目标检测
- 同花顺开户能直接开吗?开户安全吗?怎么办理开户??
猜你喜欢
随机推荐
谁是预制菜赛道的“卷”王?
Area line chart of data visualization chart
Talking about load
Is Yimeng trader software reliable? Is it safe to buy stocks?
Interview algorithm questions
Embedded development: seven skills of using RTOS
如何生成xmind的复杂流程图
吃了爱优腾的药,奈飞病情好转
Keras深度学习实战——基于VGG19模型实现性别分类
"New energy + energy storage" starts from the digital twin, Tupu will make smart power to the extreme
Web3,加密VC新风口
8.026 billion yuan! The state Internet Information Office imposed administrative penalties related to network security review on didi in accordance with the law
253会议室 II
Loadlibrary Failed with Error 87 | Open QTCreator Failed
带你认识8个软件设计中的谬误
ECCV 2022 | fix the performance damage of large targets caused by FPN: you should look at all objects
创建私有CA,我就用openSSL
Matlab GUI programming skills (IX): explain the uitable function display table and related operations in detail (create table user interface)
mysql8中timestamp时间戳设置默认值 CURRENT_TIMESTAMP ,Error:1048 - Column ‘createTime‘ cannot be null
C create user defined exception