MS CRM - setVisible

巧了我就是萌 提交于 2019-12-01 06:42:58
glosrob

Just to add to the points already made..

The difference between

Xrm.Page.ui.tabs.get('new_fieldname').setVisible(false);

And

Xrm.Page.getAttribute('new_fieldname').controls.get(0).setVisible(false);

The first refers to a tab (Xrm.Page.ui.tabs), the second refers to an attribute (Xrm.Page.getAttribute).

So if you wanted to hide a whole tab, its sections and fields you can use the first one. If you want to just hide an individual field you can use

Xrm.Page.getControl("new_fieldname").setVisible(false);

Which is itself a shortcut from

Xrm.Page.ui.controls.get('new_fieldname').setVisible(false);

to hide a text field the right method is this:

Xrm.Page.getControl("new_fieldname").setVisible(false);

The attributes are the data, the controls are the HTML Dom objects. You don't tell the data to hide, you tell the control that is displaying the data to hide.

Mamdouh Emara

Besides using JavaScript to show/hide field you can use Business Rule to do the same job also CRM platform built to make things easier so when you want to do anything in CRM you must think about it with this order:

  1. Out of the box.
  2. Customization.
  3. Business Rule.
  4. Workflow.
  5. JavaScript.
  6. Plugin-Workflow Activity.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!