简体   繁体   English

CRM 2015,如何使用JavaScript显示/隐藏快速查看控件?

[英]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. 我还不能在堆栈交换上发布图像,所以我已将它们上传到我的托运箱中供您查看。

  1. Setting a quick form up on the account record 在帐户记录上设置快速表格
  2. Finding the full Id of the field 查找该字段的完整ID
  3. Code Sample using the Id to alert the value 使用ID提醒值的代码示例

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.

相关问题 如何使用Javascript在CRM 2016中隐藏功能区按钮 - How do I hide a ribbon button in CRM 2016 using Javascript Javascript-如何使用键盘键显示和隐藏元素? - javascript - How do I show and hide an element using keyboard keys? 如何在Javascript中使用此方法显示和隐藏DIV? - How do I show and hide a DIV using this method in Javascript? 如何使用JavaScript调用在CRM中隐藏Silverlight控件? - How to hide silverlight control inside CRM with javascript call? crm 2011如何使用javascript隐藏/显示功能区按钮 - crm 2011 how to hide/show the ribbon button with javascript 如何使用JavaScript在CRM 2011中读取以下属性? - How do I read an attribute below in CRM 2011 using javascript? Dynamics CRM 2015:如何获得创建的Web资源按钮以引用添加到表单的Javascript库中的函数? - Dynamics CRM 2015: How do I get a Web Resource button I created to reference a function in a Javascript Library I added to the form? 如何隐藏和显示标签控件JavaScript? - How to hide and show label control JavaScript? MS CRM 2015使用JavaScript从另一个实体记录iFrame中按ID编辑和显示自定义实体记录 - MS CRM 2015 Edit and show a custom entity record by id from another entity record iFrame using JavaScript crm 2011使用javascript在仪表板上隐藏和显示子网格 - crm 2011 hide and show subgrids on dashboard with javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM