Change the ribbon button text (CRM 2011 online) RRS feed

  • Question

  • Hi All,

    I have created a custom button on the Quote entity ribbon area. Depending upon some condition in script I am changing the button text.

    Using a javascript function in Quote entity page load to change the button text. When the page is loading it showing the modified text.

     But after some time again it is changing to the previous text.

    I have keep the debugger in the page load javascript function , first time the script is firing. But when the button text is changing to the previous text it not going to the page load.

    Please helps me how to fix it?



    Friday, December 21, 2012 2:41 PM


All replies

  • Hi Priya,

    Changing the label using Javascript is not supported which is why you see the label going back to the previous value.

    You need to add Ribbon Customisations to do this which can be done by editing RibbonXml or you can use the Ribbon Workbench: http://ribbonworkbench.uservoice.com/knowledgebase/articles/71374-1-getting-started-with-the-ribbon-workbench

    There is no way of dynamically changing the label in a supported way - you can enable/disable buttons dynamically, or use a flyout anchor to create the buttons on the fly : http://www.develop1.net/public/post/Add-Dynamic-Menu-to-Ribbon-Button.aspx


    Scott Durow
    Read my blog: www.develop1.net/public     Follow Me on Twitter
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Friday, December 21, 2012 2:50 PM
  • Hi Scott,

    Thanks a lot for your valuable time.

    I have created two buttons on ribbon. Depending upon my condition showing and hiding the buttons in javascript .



    Saturday, December 22, 2012 1:16 PM
  • Hello Scott,

    Using javascript in form onload I am hiding and showing the custom ribbon button.

    It is working fine. But when I am updating any field, script is firing but style is not applying.

    So it is displaying all the buttons.

    Below the script I am using.

    function renameCreateContract() {
        var contractGuid = Xrm.Page.getAttribute("new_contract").getValue();
        //Getting the Create contract button ID
        var createContractBtn = top.document.getElementById("quote|NoRelationship|Form|MyOrg.Form.quote.MainTab.MyOrgQuote.CreateContract-Large");
        //Getting the Update contract button ID
        var updateContractBtn = top.document.getElementById("quote|NoRelationship|Form|MyOrg.Form.quote.MainTab.MyOrgQuote.UpdateContract-Large");
        //If the contract look field contains data
        if (contractGuid != null) {
            updateContractBtn.style.display = '';
            createContractBtn.style.display = 'none';
        else {
            createContractBtn.style.display = '';
            updateContractBtn.style.display = 'none';

    I am doing anythig wrong?



    Monday, December 31, 2012 5:42 AM
  • Hi,
       Instead of using JScript to hide/show ribbon buttons, better approach and supported way is to use DisplayRule. For your requirement, you can use DisplayRule with ValueRule. You can check following posts to see how you can achieve it.


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Monday, December 31, 2012 7:06 AM
  • Hi Vicky,

    Thanks for your replay.

    The above links are using the static value for value rules.

    Can you please provide some information for dynamic value rules?

    • Edited by PriyaSwain Wednesday, January 2, 2013 6:33 AM
    Wednesday, January 2, 2013 6:33 AM
  • Hi Priya,

    Unfortunately, you can only use Custom Javascript rules with enable/disable rules. You could try using JavaScript to set a value on the form and then refreshing the ribbon with a value rule.


    Scott Durow
    Read my blog: www.develop1.net/public     Follow Me on Twitter
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Wednesday, January 2, 2013 7:21 AM