Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Can you set a specific "Form" when "New" button is clicked?

Posted on by 200

I am using the "Case" entity and I would like to have multiple forms based on my case types. What I am looking to do is set the form when the new button is clicked so when the user arrives at the form the correct form is being displayed.

Ex. 1 - Add a flyout to the new button so all the case types are listed and when the correct case type (or form type) is selected the corresponding form is populated

Ex. 2 - When the "New" button is clicked trigger a popup that has dropdowns to select the case type (or form type).

Thank you in advance.

*This post is locked for comments

  • felipegs Profile Picture
    felipegs 95 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    Probably what you can do is to hide/show sections or tabs from your form depending on some field or form value. You can acomplish that by using this sintax.

    //Shows a tab
    Xrm.Page.ui.tabs.get("tabname").setVisible(true);
    //Hides a tab
    Xrm.Page.ui.tabs.get("tabname").setVisible(false);
    
    
    //Shows a section
    Xrm.Page.ui.tabs.get('tabname').sections.get('sectioname').setVisible(true);
    
    //Hides a section
    Xrm.Page.ui.tabs.get('tabname').sections.get('sectioname').setVisible(false);

    And you can use conditions like form type, I mean, if is an Update or Create, condition could go like follows:

    if (Xrm.Page.ui.getFormType() == 1)//Create
    {
        //Show/Hide something
    }
    
    //FORM TYPES
    
    //0 Undefined
    //1 Create
    //2 Update
    //3 Read Only
    //4 Disabled
    //6 Bulk Edit


  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    Try hiding the sections/tabs instead. Might be a better solution either way.

    If you are ok to at least entertain that idea, this may help:

    http://www.itaintboring.com/dynamics-crm/how-to-lock-and-hide-controlssectionstabs-in-a-structured-way-part-2/

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    The last form that was opened will be the form that it will default to.

  • whatup Profile Picture
    whatup 200 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    It's just so terrible that i cannot hide subgrids and quick views

  • whatup Profile Picture
    whatup 200 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    Another question... If I open the form from view will it default to the default form?

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    There is one thing that you can probably do.

    You can replace the existing Form button with a new Flyout button that has the different types of forms that you want to use (or if you don't want to use a flyout, just create a new button with a custom action)

    If you use the flyout, set each button's command to call a javascript function.

    In the JavaScript function reload the form with the following url:

    https://org.crm.dynamics.com/main.aspx with the formId={GUID OF FORM} as one of the page parameters

    Test this out and see if it works for you...

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Can you set a specific "Form" when "New" button is clicked?

    Hi,

     you can't do that. The earliest moment you can actually switch the forms is in the onload event of those forms. So, yes, you will see the form loaded first.. and, then, you can use javascript to navigate to another one.. That's not the best user experience - that's why it's probably better to simply hide and show sections/tabs/fields on a single form. But, sometimes, that hide/show logic can become too complicated.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans