RE: Webresource button at top of form
Hi Bachchan,
please note the following method is highly UNSUPPORTED and is based on 365 ribbon.
You can reach your goal without webresource, simply adding javascript to form.
Proceed as follows:
1) Include jquery library in entity form (first item)
2) Include a js file library with the OnLoad method
3) Insert this code into OnLoad method:
var intervalcount = 0;
var interval = setInterval(function(){
var myid = 'account|NoRelationship|Form|MyNewButton'; // <-- new button id
var findel = window.top.document.getElementById(myid); // find new button
if(findel != null) // return if found
return;
// get source button
var el = window.top.document.getElementById('account|NoRelationship|Form|Original.Button.Id');
var origbutton = $(el);
var newbutton = origbutton.clone(myid);
newbutton.attr('id', myid);
newbutton.attr('title','My Button');
newbutton.attr('command','');
newbutton.insertAfter(origbutton);
newbutton.on('click',function(){ alert("Hello!");}); // <-- put here your method
newbutton.find('.ms-crm-CommandBar-Menu').text('My Button');
newbutton.find('.ms-crm-CommandBar-Menu').attr('command','');
if (intervalcount > 10) {
clearInterval(interval);
}
}, 1000);
Please note:
1) setInterval is required because without button disappears after been added
2) after ten call, setinterval will be nulled
3) Hover effect doesnt works (probably is added runtime by ms code)
Please let me know.
If you found the answer helpful, please mark as Verified
Join my network on LinkedIn Follow me on Twitter
Thank You & Best Regards
Francesco Picchi
Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY
Independent Contractor
http://www.francescopicchi.com