Home > CRM Customization > JScript :: Hide ISV.config buttons

JScript :: Hide ISV.config buttons

March 4th, 2009

I needed to hide a button that I added to my form using the ISV.config file.  CRM dynamically generates the button ID and with CRM 4.0 it does not seem to be consistent like CRM 3.0.  For example, in CRM 4.0, the ID of the button may be ISV_New_24_CreateOrder and then ISV_New_25_CreateOrder the next time that you load the page, whereas with CRM 3.0 it would have consistently been ISV_New_24_CreateOrder.

The code below loops through all objects on the webpage with a tag name of ‘LI’ looking for one that has a title of ‘Create Order’ which is specified in the ISV.Config file and therefore always consistent.  Once the code finds the right one, it gets hidden.

var tag = document.getElementsByTagName(’LI’)
for(x = 0; x < tag.length; x++){
if(tag[x].getAttribute(’title’) == ‘Create Order’)
{
button = document.getElementById(tag[x].getAttribute(’id’));
if(button != null)
button.style.display = ‘none’;
x = tag.length;
}
}

Probably not the most efficient since there are a lot of objects with a tag name of ‘LI’ but I was not able to notice any decrease in performance.  I did add code (x = tag.length;) to force the loop to end once the right object has been found so that should cut down on the looping and therefore increase performance.  You would obviously not want to add this though if you need to find many different buttons.

Author: Tyler Sand Categories: CRM Customization Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.