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

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

javascript giving error

(0) ShareShare
ReportReport
Posted on by 10

Hi,

I am hiding fields based on optionset value.Even business rule is not working 

if(value == 920000000)
{
formContext.getAttribute("changingsegmentfrom").setVisible(false);
formContext.getAttribute("changingsegmentto").setVisible(false);
formContext.getAttribute("custid").setVisible(false);
formContext.getAttribute("iscurrentteam").setVisible(false);
formContext.getAttribute("quarterin").setVisible(false);
}

Getting the below error

TypeError: Cannot read properties of null (reading 'setVisible')

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,084 Moderator on at
    RE: javascript giving error

    one of the field names is not correct or not added to the form

  • Suggested answer
    Flydancer Profile Picture
    1,332 on at
    RE: javascript giving error

    Re-check the internal names of the fields, probably you're missing the prefix like "new_custid" or something like that

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 242

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 83 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 68 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans