We know that we can create Custom ISV button on entity toolbar, but if you want you can also create a Hyperlink button on entity toolbar using DOM without using ISV config file,also can call your JS function on your on form onload on click of that.Before starting this let’s first check structure of crmMenuBar ( In my example I am creating this button in Account Entity)
So using JS we can add a new TD element and can set it’s innerHTML property to create a hyperlink button. And if you want to call a JS function that you can do that just create a JS function on CRM form like below
Funcion on form load
MyDemo=function()
{
alert(‘Hi’);
}
Code to create hyperlink control
var _Table = document.getElementById(‘mnuBar1’);
var _TbleBody = myTable.getElementsByTagName(‘tbody’)[0];
var _TR = myTable.getElementsByTagName(‘tr’)[0];
var _TD = document.createElement(‘td’);
_TD.innerHTML =”<a href=’javascript: MyDemo ();’> Test </a>”
_TR.appendChild (_TD);
After this the structure will be like
Also you can add style to this button just like as CRM control, hopefully I will cover this in my next post.
But surely this is Unsupported 🙁
The only question is why would you do this? It’s completely unsupported and I don’t see any advantage to this over using a standard ISV button… Could you maybe explain in what scenario this would be better than the standard ISV button?
Yes, surely it’s unsupported customization and not best option.But the though of creating a button which right aligned, is behind this experiment. 🙂