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
Leif WangLeif Wang 

help with grey custom button for standard details page

I am new to salesforce and Here is the task for me:
1. no visualforce page is allowed. Use standard details page only.
2. On the standard page, add a custom button to perform some function. 
3.when the standard page is loaded. Based on the object status (there is a status field) ,  make the button inactiv (greyout) or active. You can not click the custom button to make it inactive or active.

Because the standard page is used here, I have no clue to trigger the javascript behind the custom button without clicking it. Any suggestion?  Many thanks and urgent.

 
GovindarajGovindaraj
Hi Leif,

You can use the JavaScript behind that custom button. (Not preferred but this the only option i believe)

Ref : https://salesforce.stackexchange.com/questions/112365/disable-custom-button-in-standard-page-layout

Thanks,
Govindaraj.S
Leif WangLeif Wang
Thanks Govindaraj,
I have discussed witht the team lead. There is a property of the object. We decided to use the value of  that property to tell whether the button should be disabled or not. A simple if sentence solved the problem. Anyway, I leant to find the custome button id from your link, that will be helpful for my future coding.

Thanks.