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
karthik Jonnalagaddakarthik Jonnalagadda 

Disable and Enable Custom button

Hello All,

I have one custom button in custom object view details page. I want enable or disable button based on condition whether current record exits on another custom object. Is is possible ? if so please suggest some steps to do
Mudasir WaniMudasir Wani
Hi Karthik,

It is not possible.

Have a look on record type may be that will give you an idea.
Because using Record type you can have different page Layouts.


Record Types Overview
https://help.salesforce.com/HTViewHelpDoc?id=customize_recordtype.htm

Creating Record Types
https://help.salesforce.com/HTViewHelpDoc?id=creating_record_types.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=creating_record_types.htm&language=en_US)

How is record type access specified?
https://help.salesforce.com/HTViewHelpDoc?id=permissions_record_type_access.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=permissions_record_type_access.htm&language=en_US)

Administrator tip sheet: Tips & Hints for Record Types
https://na1.salesforce.com/help/pdfs/en/salesforce_recordtypes_cheatsheet.pdf

Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
 
Bertrand PolusBertrand Polus
Hi, if your View Detail Page is a Visualforce Page, nothing forbids you to Enable / Disable your buttons depending on any condition.

In your page:
<apex:commandButton action="{!youmethod}" value="ButtonName" disabled="{!isBtnDisabled}"/>

On your controller class, create a property isBtnApplyVisible which has to be filled in the constructor method of the controller.

Hoping this solution will help you...