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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Open related form in account with case form using subgrid

(0) ShareShare
ReportReport
Posted on by 958

Scenario is: -

I have 2 account form A and B and 2 case form i.e. C and D.

I also have a sub grid of associated case in account form.

I want to do that if account form A is open and i want to add a new case in account form A then open only case form C and for account form B open case form D form associated case subgrid.

How can i do this?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Shakti , 

    Go to ribbon workbench with a test solution entity Case .

    Go to sub grid area  of Incident entity in the ribbon workbench and hide OOB Add new  button and create new custom add new button and register below function in action method.

    function OpenCaseFormBasedOnAccoutFormID() {
    
        var formId = Xrm.Page.ui.formSelector.getCurrentItem().getId();
      
        if(formId == "GUID of FROM A")
        {
            var parameters = {};
            parameters["formid"] = "70fa962b-7151-4b07-9031-6b5b53f9aeef";  //replace Form C ID
            Xrm.Utility.openEntityForm("incident", null, parameters, null);
        }
        else (formId == "GUID of FROM B")
        {
            var parameters = {};
            parameters["formid"] = "70fa962b-7151-4b07-9031-6b5b53f9aeef"; // replace Form D ID
            Xrm.Utility.openEntityForm("incident", null, parameters, null);
        }
    }


     Hope this helps.

  • Shakti Singh Rajput Profile Picture
    958 on at

    Thanks Das,

    In which entity i have to use this solution in account or case?

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    off course in Case entity as subgrid is for case entity.

  • Shakti Singh Rajput Profile Picture
    958 on at

    But if i choose case entity then how can i add a custom button in sub grid of case because  that subgrid is in account form.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    You are adding add new button in the subgrid of case entity. So open case entity in ribbon workbench and go to subgrid area of ribbon and add new button there button will show anywhere in the case subgrid no matter in which form subgrid will display.

  • Shakti Singh Rajput Profile Picture
    958 on at

    casegrid22.png

    casegrid22.png

    In above screenshots i am successfully create a button in subgrid and add action of javascript, but it not works. You can see in subgrid of case, and i did also hide the OOB button but after that also it not works at all.

  • gdas Profile Picture
    50,091 Moderator on at

    The button is not showing ?or the function is not calling?

    Seems something you are missing , try to fill all the required  information in the ribbon , you can also compare with OOB add new button and fill all the option in the ribbon workbench.

  • Shakti Singh Rajput Profile Picture
    958 on at

    Both the button is not visible and don't know about function calling.

  • Shakti Singh Rajput Profile Picture
    958 on at

    function OpenCaseFormBasedOnAccoutFormID() {

       var formId = Xrm.Page.ui.formSelector.getCurrentItem().getId();

       if(formId == "8448b78f-8f42-454e-8e2a-f8196b0419af")

       {

           var parameters = {};

           parameters["formid"] = "4a63c8d1-6c1e-48ec-9db4-3e6c7155334c";  //replace Form C ID

           Xrm.Utility.openEntityForm("incident", null, parameters, null);

       }

       else (formId == "b65155fd-e879-4b08-917f-6ff98c465cde")

       {

           var parameters = {};

           parameters["formid"] = "567a78c8-8b40-4dc9-b423-8074c38ce14f"; // replace Form D ID

           Xrm.Utility.openEntityForm("incident", null, parameters, null);

       }

    }

    This is the code of your with customization.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Shakti ,

    Please refer below , hope this helps.

    www.inogic.com/.../hide-add-button-on-a-subgrid-by-applying-custom-javascript-rule

     

    Code is find only you need to add window.parent  -

     var formId = window.parent.Xrm.Page.ui.formSelector.getCurrentItem().getId();

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans