[SalesForce] Hide and show a custom button on a standard detailed page

We have 2 custom buttons on a standard lead detailed page. I would like to show one button and hide another button on page load using javascript by querying the lead and finding a value in one text box field. The logic is if the textbox value is null, we want to show one custom button which has its own javascript code, else we will hide the custom buttton and show another one with its own javascript code. Is this possible and if so how do we do this?
Buyan

Best Answer

You might be able to do this with a sidebar JS hack, but that's not my realm of expertise.

Declaratively, you could have the null/non-null values of the text field trigger workflow that changes the Lead Record Type and assign different page layouts to the two record types that are identical except for their respective buttons.

Related Topic