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)

UI issue when using JavaScript onChange to show/hide section containing subgrid

(0) ShareShare
ReportReport
Posted on by

I have a section on a custom entity's Information form that contains a couple fields and a sub-grid of contacts (labelled participants). When I use the below JavaScript to show/hide that section based on another field selection, under certain circumstances it consistently appears incorrectly. This only occurs when I have the record saved in a way where this section is hidden, and then I change the field that triggers it to display. If I then save the record and refresh it, it displays properly. It would seem that the onLoad JavaScript works fine, but when I call the same function as an onChange for the pll_service field it is appearing as shown in the image below. Any thoughts on this? Functionality doesn't seem to be impacted, it just looks wrong.

 

JavaScript used: (called as an onLoad function and as an onChange function for the pll_service field which is an option set data type)

function trainingIncluded(){
var trainingStatus = Xrm.Page.getAttribute("pll_service").getText();
if(trainingStatus != "Training")
{
Xrm.Page.ui.tabs.get("General_Tab").sections.get("Training").setVisible(false);
}
else
{
Xrm.Page.ui.tabs.get("General_Tab").sections.get("Training").setVisible(true);
}
}

 

Image of issue: (Note how the label of "Participants" as well as the buttons for adding records/viewing grid are shown within the column headers instead of above)

 UI-Issue-with-subgrid.PNG

*This post is locked for comments

I have the same question (0)
  • Verified answer
    tpeschat Profile Picture
    4,930 on at

    Had the same issue on CRM 2015. With update to CRM 2016 the problem was gone. But now I have some other issues instead ;)

  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    6,804 on at

    Hi CRMUser13,

    Two things to check.

    1. Press F12 and see if there are any errors on the page.  When a JavaScript error occurs, the code after it may not run.

    2. Are there any web resources on the form?  It is possible that some CSS or JavaScript on a web resource mess up the UI.

  • Community Member Profile Picture
    on at

    I didn't have any real luck troubleshooting in 2015, but now that I'm on 2016 this issue is gone.

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