function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sflearningsflearning 

Greyed out javascript button on standard object

Hi,
I have a javascript button on click event on opportunity object...it works well..
Now i want if stagename = 'ABC', only then it gets enable ...otherwise it should be hidden or greyed out...
any help will be appreciated...
Thanks in advance!!!
 
Lokesh KumarLokesh Kumar
Hi,

Here is no way to disable button but you can extend your JavaScript code to notify user like:
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
if("{!Quote.Status}" != "Accepted"){
var QuoteId = "{!Quote.Id}";
alert(QuoteId);
sforce.apex.execute("GenerateXMLOnQuoteAccept","generateXML",{QId:QuoteId});
alert('done');
}
else
{
alert('Error:Quote is already accepted');
}

OR

check this link https://salesforce.stackexchange.com/questions/107508/hide-custom-javascript-button-on-certain-conditions

Thanks
Lokesh
satya aryasatya arya
Hello sflearning,

Create a validation rule will solve your purpose

Yhanks,
Satya (me too sflearning) :)
Dev-FoxDev-Fox
Hi,

Through standard page, you can achieve such requirement. Override the standard page with custom visualforce page and use apex:detail tag in it. Then you will get control on every individual field, button along with other operations.

If overriding is not your option, create a custom and place it in side bar or footers so that you can get limited access on current standard screen.