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
CBiZcuitCBiZcuit 

Overriding standard button on Related List Section

We have a related list on the Account page layout for opportunities.  We want to hide the standard button "new" based on an Account's field. 

 

So it would be:

if (!Account.isAttest)

{//show the "new" button on related list for opportunity}

else

{//hide the "new" button}

 

How would we go about handling this?

Best Answer chosen by Admin (Salesforce Developers) 
CBiZcuitCBiZcuit

After digging for awhile I solved this myself. 

I created a New List Button (make sure it is a "List Button" type or you wont be able to add it to a page layout)

This calls a simple javascript function based on the {!Account.Attest__c}. 

I added this New Button on the Account page layout, Opportunities Related List Section and unchecked Standard Button and voila!