Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS CRM - setVisible

I am newbie with CRM and I was googling for how to hide and show a text field using jScript library in MS CRM (online) and found several options of using the function setVisible.

I tried those options:

  1. Xrm.Page.ui.tabs.get('new_fieldname').setVisible(false);
  2. Xrm.Page.data.entity.attributes.get('new_fieldname').setVisible(false);
  3. Xrm.Page.getAttribute('new_fieldname').controls.get(0).setVisible(false);

But only the last one is really working. The first option gives me an error message.

What is the different between them?

like image 747
ParPar Avatar asked May 19 '13 11:05

ParPar


1 Answers

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);
like image 91
glosrob Avatar answered Oct 08 '22 06:10

glosrob