Skip to main content

Notifications

Community site session details

Community site session details

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

The "Plus Button" is missing in the subgrid after adding the OnLoad event handler, CRM 365.

(0) ShareShare
ReportReport
Posted on by 10

Dear all.


Microsoft Dynamics 365. Version 1612 (9.0.8.9).
I am facing a problem with customising a subgrid, adding an event handler OnLoad.


I add an OnLoad event handler to the subgrid.
The addition occurs when the form is loaded on the OnLoad event of the form, using the technique described in the documentation.
docs.microsoft.com/.../addonload
The handler is added successfully and works. But after adding the OnLoad handler, the presence of the "Plus button" on the subgrid becomes unstable.
In other words: it is impossible to predict the presence of the "Plus Button" on the subgrid, with each new loading of the form, if the OnLoad handler for the grid is added.

Sample code:

OnLoad: function (executionContext) {  
    var formContext = executionContext.getFormContext(); // get the form context
    var gridContext = formContext.getControl("Contacts");// get the grid context
    var myContactsGridOnloadFunction = function () { 
        console.log("Contacts Subgrid OnLoad event occurred") 
    };
    gridContext.addOnLoad(myContactsGridOnloadFunction);
}

SubGrid Image:

pastedimage1614752833995v1.png


Please help..
Thanks.

  • crm911 Profile Picture
    10 on at
    RE: The "Plus Button" is missing in the subgrid after adding the OnLoad event handler, CRM 365.

    Hello.

    If there is no other solution, I will use this approach.

    Thank you so much for your help.

  • Verified answer
    Nya Profile Picture
    29,060 on at
    RE: The "Plus Button" is missing in the subgrid after adding the OnLoad event handler, CRM 365.

    Hi,

    Inaccuracy, which you mentioned, I don't think has much effect on the results. The former is a delay for the first step and the latter is a delay for all steps.

    In terms of conclusion, my code is able to solve the problem of the button not being displayed on the version I am using and the value 3000 means that the timer is only 3 seconds long and is not felt very directly. Please try to see if this solves your problem, as no more suitable solution has been found so far.

     

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • crm911 Profile Picture
    10 on at
    RE: The "Plus Button" is missing in the subgrid after adding the OnLoad event handler, CRM 365.

    Thanks for the reply. But I would like to do without a timer. In addition, there is an inaccuracy in your code. I think it should be like this:

    function formonLoad(executionContext){
    	setTimeout(function(){ 
    		console.log("Hello");
    		var formContext = executionContext.getFormContext(); // get the form context
    		var gridContext = formContext.getControl("Contacts");
    		var myContactsGridOnloadFunction = function () { 
    			console.log("Contacts Subgrid OnLoad event occurred") 
    		};
    		gridContext.addOnLoad(myContactsGridOnloadFunction);
    	}, 3000);
    }

  • Suggested answer
    Nya Profile Picture
    29,060 on at
    RE: The "Plus Button" is missing in the subgrid after adding the OnLoad event handler, CRM 365.

    Hi,

    I can reproduce your issue with Version 1612 (9.0.2.3034) and I found that several other users have given feedback on similar issues.

    e.g. Add new button disappeared from subgrid - Microsoft Dynamics CRM Forum Community Forum

     

    According to my tests, it should be that the JS takes effect before these buttons are loaded. The buttons can be shown after refreshing the page. So I added a setTimeOut in the function.

     

    Here is my code.

     

    function formonLoad(executionContext){
       setTimeout(function(){ console.log("Hello"); }, 3000);
       var formContext = executionContext.getFormContext(); // get the form context
        var gridContext = formContext.getControl("Contacts");
    var myContactsGridOnloadFunction = function () { 
            console.log("Contacts Subgrid OnLoad event occurred") 
        };
    gridContext.addOnLoad(myContactsGridOnloadFunction);
    }

    Add it into the main form of Account and set it as the following image.

    pastedimage1614828888766v2.png

    pastedimage1614828895525v3.png

    After adding the setTimeOut, the add button can be shown when the page is loaded for the first time.

    pastedimage1614828730173v1.png

    Please have a try to figure out if it will solve your problem.

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 61 Most Valuable Professional

#3
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans