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 CRM (Archived)

Hiding fields dependent upon a boolean

(0) ShareShare
ReportReport
Posted on by 10

I have 2 fields, "Is there Split Level Access?" (boolean) and "Split Level Access details" (memo). What I want to do is set up the "Split Level Access details?" field to be hidden unless you choose "Is there Split Level Acccess?" = Yes. At which point I want the "Split Level Access details" field to appear.

I have set an On Change event for field "Is the split level access?" with a webresource library gm_splitlevelaccess and the function called "Splitlevelaccess". The script is:

function Splitlevelaccess() {

   var splitlevelaccess = Xrm.Page.getAttribute('gm_istheresplitlevelaccess').getValue();

   if (splitlevelaccess == 2) {

       // There is split level access. here are the details

       ShowControl('gm_splitleveldetails');

   } else {

       // not split level access

       HideControl('gm_splitleveldetails');

   }

Now the problem I have is that the "Split Level Access details" field is not hidden when you load the form and then when you change the "Split Level Access?" question to "Yes", I get an error:

"There was an error with this field's customised event.

Field:gm_istheresplitlevelaccess

Event:onchange

Error: The value of the property 'Splitlevelaccess' is null or undefined, not a function object.

Can anyone tell me what is missing as I am stumped....

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Hosk Profile Picture
    on at
    RE: Hiding fields dependent upon a boolean

    The best way to find out the problem is to debug the javascript.  The error seems to be saying the function doesn't exist maybe

    Splitlevelaccess

    So have you attached the javascript to the form?  You can do this by going to customization, form, form properties and then you need to add your javascript file to the manage libraries.

    below are some useful links to debug your javascript

    Debugging javascript

    www.furnemont.eu/.../how-to-series-easily-debug-your-crm-javascript-code-in-ie8

    this shows you how to get the debugger up

    www.youtube.com/watch

    long javascript youtube tutorial

    www.youtube.com/watch

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans