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)

Hide the 'New' button for a specific Account form

(0) ShareShare
ReportReport
Posted on by

Hi,

Can anyone suggest the best way of hiding the '+New' button from all ribbons for a specific Account form?

I am in the process of creating a new account form which will not include many fields that are required when setting up a new account.  I want users to switch to using the standard form when adding new accounts.  I'm concerned that if they add a new account via the new form then the record will be missing many important fields.

I've just installed Ribbon Workbench 2016 and started looking at it, although have much to learn!  I haven't seen anything obvious that enables hiding / disabling buttons based on the form loaded.  It all seems to be based around the actual entity.

Any ideas are most welcome.

Many thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Hide the 'New' button for a specific Account form

    Hi,

    You will need to use the enable rules(show/hide your button) and a custom Javascript function(to find out if you are on the correct form).

    Here is an example of how to add a custom Jscript rule to your button:crmblocks.blogspot.ch/.../how-to-implement-enable-rule-on-ribbon.html

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Hide the 'New' button for a specific Account form

    Hi,

    You can hide out of the box new button and create a custom new button and can always open your default form using Xrm.Utility, Check our post for your reference: http://himbap.com/blog/?p=1486

    Thanks

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Hide the 'New' button for a specific Account form

    Hi Matt,

    if you want a solution as fast as unsupported, you could use the following script only in the form you need:

    function FormOnLoad() {
        var intervalcount = 0;
        var interval = setInterval(function(){
            var newbuttonid = 'account|NoRelationship|Form|Mscrm.NewRecordFromForm';
            
            var newbuttonelem = window.top.document.getElementById(newbuttonid);
            if (newbuttonelem) newbuttonelem.style.display = 'none';
    
            intervalcount++;
            if (intervalcount > 10 || newbuttonelem != null) {
                clearInterval(interval);
            }
        }, 1000);
    }

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at
    RE: Hide the 'New' button for a specific Account form

    I am not sure if this might be an alternative for you, but you can also add JavaScript code on the form load event, to check if the form status is Edit or Create. If it's Create and you are on the wrong form, redirect the users to the other form.

    Regardless of that option, you can always add or remove buttons from the command bar (ribbon), by setting an enable rule that will call a JavaScript method. The method will check the form name, and return a true or false value (whether or not that button should be displayed).

    Hope this helps.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Hide the 'New' button for a specific Account form

    Hi Matt07,

    if you solved the problem thanks to an answer, please mark it as verified to encourage the community to provide more and more a better support. Thank you. Francesco

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Matt07 Profile Picture
    on at
    RE: Hide the 'New' button for a specific Account form

    Many thanks Francesco and thanks to everyone that replied with suggestions as they were all really helpful.

  • Suggested answer
    ARIFNIIT Profile Picture
    1,391 on at
    RE: Hide the 'New' button for a specific Account form

    Create a enable Rule and use JavaScript function for this rule. return true for a specific form. you will get form detail in JavaScript.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans