Useful CRM Tips

Useful CRM Tips...

Thursday, October 06, 2011

Add a Button On Top of a CRM FORM


        You will achieve the above result with the below js customization:

You need to place below java script on the load event of the form.



/* Code to add a button dynamically on top of a CRM form */

if (document.getElementById('_MBcrmGridAddBidders') == null) {
    var li = document.createElement("li");
    li.id = "_MBcrmGridAddBidders";
    li.className = "ms-crm-Menu";
    li.title = "Add Bidders";
    li.tabIndex = -1;
    li.onclick = function () { Execute(); }
    li.innerHTML = "<SPAN class='ms-crm-Menu-Label'>" +
"<IMG class=ms-crm-Menu-ButtonFirst tabIndex=-1 alt='AddBidders' src='/Crestwood/_Common/icon.aspx?objectTypeCode=10001&iconType=DBGridIcon&inProduction=1&cache=1'>" +
"<SPAN class=ms-crm-MenuItem-TextRTL tabIndex=0>Add Bidders</SPAN>" +
"</A>" +
"</SPAN>";
    var ele = document.getElementsByTagName("ul");
    for (i = 0; i < ele.length; i++) {
        if (ele[i].className == "ms-crm-MenuBar-Left") {
            ele[i].appendChild(li);
            break;
        }
    }
}

No comments:

Post a Comment