web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

how to use the xrm.page api to hide a control?

(0) ShareShare
ReportReport
Posted on by

Hello - How can I hide a control with the Xrm.Page API? I've seen different ways to get a reference to a CRM control. For example:

var control = Xrm.Page.getControl("some_control_id")

However, when I execute this code in the FireBug console for a CRM form, the console displays an error:

"Object doesn't support property or method 'getControl'"

Also, although Xrm.Page returns a reference in a FireBug watch, Xrm.Page.ui returns null. So as can be expected I don't have a reference to Xrm.Page.ui.controls in Firebug.

I was thinking that all CRM forms should have full access to the Xrm.Page API by default. Do I need to add some type of reference or setting to the form to get full access to the XRM API, do I need to access the XRM API differently or is something else missing?  Also, after I get to the point where I can get a reference to the control, does Xrm.Page make it fairly easy to hide the control? For example:

var control = Xrm.Page.getControl("some_control_id"); control.hide();

Thanks for your input on this!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Muhammad Adeel Javaid Profile Picture
    5,580 on at

    Xrm.Page.getControl("name").setVisible(false); will hide a control. You can view the use of form controls here:

    msdn.microsoft.com/.../jj602964.aspx

  • Suggested answer
    Community Member Profile Picture
    on at

    Xrm.Page.ui.controls.get("controlname").setVisible(false);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans