With the below code you can achieve the above functionality:
/* Code to add a Button in Action Menu List of a CRM FORM */
/* Code to call a js function on item click */function TestAction() {
alert("Hi..");
}
alert("Hi..");
}
if (document.getElementById("_MBTestAction") == null) {
var elem = document.getElementById("mnuaction");
var elem = document.getElementById("mnuaction");
var newEle = document.createElement("li");
newEle.id = "_MBTestAction";
newEle.className = "ms-crm-MenuItem-Label";
newEle.tabIndex = -1;
newEle.action = "TestActionTest();";
newEle.innerHTML =
"<SPAN class='ms-crm-MenuItem-Label'><A class='ms-crm-MenuLink' tabIndex='-1' onclick='return false;' href='javascript:onclick();' target='_self'><SPAN class='ms-crm-MenuItem-Icon'></SPAN><SPAN class='ms-crm-MenuItem-Text' tabIndex='0'>Do Test Action...</SPAN></A></SPAN>";
elem.appendChild(newEle);
}
newEle.id = "_MBTestAction";
newEle.className = "ms-crm-MenuItem-Label";
newEle.tabIndex = -1;
newEle.action = "TestActionTest();";
newEle.innerHTML =
"<SPAN class='ms-crm-MenuItem-Label'><A class='ms-crm-MenuLink' tabIndex='-1' onclick='return false;' href='javascript:onclick();' target='_self'><SPAN class='ms-crm-MenuItem-Icon'></SPAN><SPAN class='ms-crm-MenuItem-Text' tabIndex='0'>Do Test Action...</SPAN></A></SPAN>";
elem.appendChild(newEle);
}
/* Code to add function to the Event Called from Button */
TestActionTest = TestAction;
No comments:
Post a Comment