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
mpoiriermpoirier 

Extending SalesForce objects

I need to have a Boolean 'selected' field to display a checkbox in a pageBlockTable.

 

Please tell me I can do this:

 

public class ibPricebookEntry extends PricebookEntry { Boolean selected; public Boolean getSelected() { return selected; } public void setSelected(Boolean s) { selected = s; } }

 

 

Right now, I get this message at compile time:

 

Error: Compile Error: addProductsToQuote.ibPricebookEntry: Non-exception class must extend another user-defined non-exception class: PricebookEntry 

 

Anything else special I need to add to my custom class ? 

 

I hope I do not need to add a Boolean field in the PricebookEntry object !

 

 

Best Answer chosen by Admin (Salesforce Developers) 
hisrinuhisrinu

 You use the following link for displaying the checkboxes.

 

http://wiki.developerforce.com/index.php/Checkbox_in_DataTable

All Answers

JimRaeJimRae

I think you can only extend custom classes, not standard object classes.

You could embed your standard object in the custom class, a little messier, but might work for you.

 

 

public class ibPricebookEntry { Boolean selected {get; set;} PricebookEntry pbe {get; set;} }

 

 

 

hisrinuhisrinu

 You use the following link for displaying the checkboxes.

 

http://wiki.developerforce.com/index.php/Checkbox_in_DataTable

This was selected as the best answer
mpoiriermpoirier

Beautiful !

 

Thanks, Srini !!!