[英]CRM 2015, how do I show/hide a Quick View Control using JavaScript?
I have a Policy form based on a Policy entity, I want to show or hide a Quick View within that policy in a section. 我有一个基于“策略”实体的“策略”表单,我想在该部分的某个策略中显示或隐藏“快速查看”。 I got the name for the Quick View as "secCommercialClient" and "secPersonalClient", however I cannot seem to hide/show these quick views.
我将快速视图的名称命名为“ secCommercialClient”和“ secPersonalClient”,但是我似乎无法隐藏/显示这些快速视图。 I can do it for the field related to the quick views simply using the following code :
我可以使用以下代码针对与快速查看相关的字段执行此操作:
var personalClient = Xrm.Page.getControl("new_personalpolicyholderid");
var commercialClient = Xrm.Page.getControl("new_commercialpolicyholderid");
if(personalClient.getAttribute().getValue() == null)
{
personalClient.setVisible(true/false);
}
else if(commercialClient.getAttribute().getValue == null)
{
commercialClient.setVisisble(true/false);
}
I cannot seem to get the QuickView control to show or hide i get a error saying " Unable to get property 'getAttribute' of undefined or null reference ". 我似乎无法使QuickView控件显示或隐藏,但出现错误消息“ 无法获取未定义或空引用的属性'getAttribute' ”。 I double checked in my solution of the form that indeed the name value is secCommercialClient and secPersonalClient, I success at hiding the fields but not the actual Quick Views.
我仔细检查了以下形式的解决方案:确实名称名称是secCommercialClient和secPersonalClient,我成功地隐藏了字段,但没有隐藏实际的快速视图。
Any ideas?, I am IE's debugger tool to test my scripts on the Policy form of my CRM solution. 有什么想法吗?,我是IE的调试器工具,用于在CRM解决方案的“策略”表单上测试脚本。
I have included the image of the name property of the Quick View, am I using an incorrect name or is there something wrong in my code? 我已经包含了“快速查看”的name属性的图像,我使用的是不正确的名称还是我的代码有问题?
The string you pass in from the control has to be the full id of the field you want to return from within the quick view. 从控件传递的字符串必须是要从快速视图中返回的字段的完整ID。
for example setting a quick view on the account form (inserting the form as "MyQuickView") from the "out of the box" quick view for the user entity would allow me to alert the phone field from JavaScript on the account entity like so: 例如,从用户实体的“开箱即用”快速视图中设置帐户表单的快速视图(将表单插入“ MyQuickView”),可以让我从帐户实体上的JavaScript提醒电话字段,如下所示:
alert(Xrm.Page.getControl(" MyQuickView_MyQuickView_systemuser_mobilephone ").getAttribute().getValue()); alert(Xrm.Page.getControl(“ MyQuickView_MyQuickView_systemuser_mobilephone ”).getAttribute()。getValue());
For your example you need to reference the entire Id of the control you want to return from the entity. 对于您的示例,您需要引用要从实体返回的控件的整个ID。
I am not allowed to post images on stack exchange yet so I have uploaded them to my drop box for you to see. 我还不能在堆栈交换上发布图像,所以我已将它们上传到我的托运箱中供您查看。
https://www.dropbox.com/sh/4agr73jvhe1uxuo/AABU8ce9idnJa0bUaITnXeKAa?dl=0 https://www.dropbox.com/sh/4agr73jvhe1uxuo/AABU8ce9idnJa0bUaITnXeKAa?dl=0
EDIT: After reading your comment here is how you can hide the quick view by creating a section for it, then hiding the section 编辑:在阅读您的评论后,这里是您如何通过为其创建一个节然后隐藏该节来隐藏快速视图的方法
Xrm.Page.ui.tabs.get("SAMPLE_TAB").sections.get("SAMPLE_SECTION").setVisible(false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.