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

Hide Button

Dear developers,


Is there a way I can hide a button in standard sales force page? There is a button in one of the objects page that opens up to a visual force page. I need the button to be hidden until certain condtions are met on the objects page is that possible, if so how?



Thanks in advance



On the standard page you want to conditionally show or hide a button.

That is not possible on a standatd page, for that you need to create a custom VF page.

Alternatively you can add logic to the VF pafe which open on click of the button to show messages that further processing can be done only if certain conditions are met.


Hope this helps.


Thanks for the reply...I thought that the hiding the button would be the easier solution.

So this is my scenraio and where the help is needed..


There is JScript button on the custom object page which is conditonal that it only executes when a certain criteria is met, I need to add another condition to it, to make sure that an instance of a child for the parent has been created with necessary data in it, is that possible.


For eg,

There is Utilization_Report__c object (parent object) and  Utilization_Report_List_Item__c(child object), we need to verify that at least a point of sale line item is created for the parent object is that possible?


This is code snippet that is being run for now


if('{!Utilization_Report__c.Status__c}'.toLowerCase() == 'Approved by lessor'.toLowerCase()) 

window.location.href = '/apex/MaintenanceReserveInvoice?id={!Utilization_Report__c.Id}' ; 


alert('Not approved by lessor yet'); 


thanks in advance


 = 'none';

when i am using this script on my page nothing happen 

this script for  hiding work with portal button  

please give me any salution 




this is my code 


<apex:page standardController="account" >

function hide( = 'none';){

alert(); = 'none';

<apex:detail >
<apex:form >
<apex:commandButton value="name" onclick="hide()"/>