locked
Removing the 'Actions' Button from a form. RRS feed

  • Question

  •  

    This is a pretty critical issue with our rollout. instead of using the Actions Convert Lead and Actions Close Opportunities we use a special workflow and a 'won' bit field to make sure the opportunity reaches the right people before it closes.

     

    Is there some sort of coding or site map editing that would allow me to hid the Actions button...or at least the Convert Lead and Close Opportunity options in that menu?

    Friday, January 23, 2009 4:13 PM

Answers

  • The site map & ISV config allow you to add buttons.  However, you are only supported on jscript when you can get to an element via crmForm.all.???.  Since those things are not on the crmForm this solution is unsupported:

     

    Document.getElementByID("go through the source html to find the button's id").style.display = "none";

     

    I think the risk is that updates & fixes may change the element id and break your code.  Hence, you should start you form onLoad event code by declaring these types of things as constants for quick reference and modification.

     

    Friday, January 23, 2009 5:08 PM

All replies

  • The site map & ISV config allow you to add buttons.  However, you are only supported on jscript when you can get to an element via crmForm.all.???.  Since those things are not on the crmForm this solution is unsupported:

     

    Document.getElementByID("go through the source html to find the button's id").style.display = "none";

     

    I think the risk is that updates & fixes may change the element id and break your code.  Hence, you should start you form onLoad event code by declaring these types of things as constants for quick reference and modification.

     

    Friday, January 23, 2009 5:08 PM
  • Thanks I found this code online that allowed me to hide things in the toolbar. I popped this code into the onload for both the Lead and Opportunity.

     

    var Spacer = {      
        Right : 1, // hides a right spacer if it exists 
        Left : 2, // hides a left spacer if it exists 
        Both : 3, // and so on... 
        None : 4  

     
    var Display = { 
        Show : "inline", 
        Hide : "none"  

     
    function OnCrmPageLoad()  

      //Configure Display when the form loads. 
      ConfigreToolbarDisplay(); 
      //Configure the display each time a user manually changes the window width size. 
      attachEvent("onresize",ConfigreToolbarDisplay); 

     
    function ConfigreToolbarDisplay() 

        // Opportunity toolbar buttons 
        // English | German | Spanish   
        ShowHideToolbarButton( "Recalculate" , Spacer.Left , Display.Hide );     
        ShowHideToolbarButton( "Qualify or disqualify the lead" , Spacer.Both , Display.Hide );
        ShowHideToolbarButton( "Run Workflow" , Spacer.Both , Display.Hide );
        ShowHideToolbarButton( "Actions" , Spacer.Both , Display.Hide );


     
    function ShowHideToolbarButton( btnTitle , spacer , state )  
    {     
        if( isNullOrEmpty( document.all.mnuBar1 ) )  
            return; 
        if( isNullOrEmpty( btnTitle ) ) 
            return; 
        if( isNullOrEmpty( spacer ) ) 
            spacer = ToolbarSpacer.None; 
        if( isNullOrEmpty( state ) ) 
            state = ButtonDisplay.Hide; 
         
        //Get all toolbar buttons 
        var toolBarButtons = document.all.mnuBar1.rows[0].cells[0].childNodes[0].childNodes; 
         
        //Loop through each button 
        for (var i = 0 ; i < toolBarButtons.length ; i++) 
        { 
            var button = toolBarButtonsIdea
            if( button.title.match(btnTitle) != null ) 
            {              
                button.style.display = state; 
                switch(spacer) 
                { 
                    case Spacer.Right: 
                        ShowHideSpacer( button.nextSibling ); 
                        break; 
                    case Spacer.Left: 
                        ShowHideSpacer( button.previousSibling ); 
                        break; 
                    case Spacer.Both: 
                        ShowHideSpacer( button.nextSibling ); 
                        ShowHideSpacer( button.previousSibling ); 
                        break; 
                } 
     
                return; 
            } 
        } 
        function ShowHideSpacer( btnSpacer ){ 
            if( !isNullOrEmpty( btnSpacer ) ) 
                btnSpacer.style.display = state; 
        } 
        function isNullOrEmpty( obj ){ 
            return obj == null || typeof(obj) == "undefined" || obj == ""; 
        }  

     
    OnCrmPageLoad();

     

    Friday, January 23, 2009 5:30 PM
  • Also, not supported.  We couldn't make this work for the buttons on the Actions menu though it is nice because it considers the spacers.

     

    Friday, January 23, 2009 5:41 PM
  • Take a look at our state management wizard. It will enable you to block users from qualifying a lead or closing an opportunity or any other change of state behavior. http://mscrm4ever.blogspot.com/2009/01/crm-40-state-and-status-code-manager.html

    The wizard will be available next week.

    Adi

     

     

    Friday, January 23, 2009 6:04 PM