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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Show/Hide field on form

(0) ShareShare
ReportReport
Posted on by 5

I'm writing what should be a simple JavaScript web resource to show/hide several fields on a form based on a few conditions, but I'm getting an error that doesn't make any sense. I've done this exact same thing a few times before, using formContext.getAttribute(<field name>).setVisilbe(<true/false>); but now I am getting an error saying that this function doesn't exist. I am able to hide tabs and sections of the form, but not individual fields. Is this a bug or was there a recent change to this function? We're supposed to have this working for our customers tomorrow. Any help would be greatly appreciated! 

setVisible-error.PNG

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hi, 

    Try this: 

    formContext.getControl(arg).setVisible(bool);

    And remember to pass the executionContext to your function

  • Suggested answer
    Satish Tiwari - CRM Profile Picture
    on at

    Hello Allyh,

    You can also use Business rules to show / hide fields based on certain actions. You can find more details about Business rules here - docs.microsoft.com/.../create-business-rules-recommendations-apply-logic-form

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans