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
llisallisa 

Disable single Custom button.

I have 4 custom buttons with differentionality.i.e
1. Edit
2. Send to Customer
3.Create pdf
4.Rebate

The senario is if there is no pdf in the custom detail page the "Send to Customer" button is disables else if at least one pdf is there this button is enable.Please some one help me.

here i declare a boolean-

public class Controller
{
public List<Attachment> attachments{get;set;}
public Boolean sendbutton{get;set;}
public Controller(ApexPages.StandardController controller)
{
if (attachments.size()>0)
       {sendbutton=True;}
//other codes
}
}

it throws an error--Attempt to de-reference a null object 
An unexpected error has occurred. Your development organization has been notified.
MagulanDuraipandianMagulanDuraipandian
Try this

public class Controller
{
public List<Attachment> attachments{get;set;}
public Boolean sendbutton{get;set;}
public Controller(ApexPages.StandardController controller)
{
Id recId = controller.getId();
attachments = [SELECT Id FROM Attachment WHERE ParentId =: recId ];
if (attachments.size()>0)
       {sendbutton=True;}
//other codes
}
}

www.infallibletechie.com
llisallisa
Hi Magulan,

Thanks for your Reply. but it is throwing an error i.e- Attempt to de-reference a null object