i have a custom object called File_Uploaded__c and i have a visual force page which will generate details page for the file based on its fields: here's the definition of my visual force page:

<apex:page standardController="File_Uploaded__c" >


As you can see the controller for this page is the the custom object itself.

and the fields that i will use in this page are encoded in JSON format, so i need to define a method that transform all those fields to a normal format and then use them in my page, But the problem i don't know how to define method associated with my custom object.

  • Google "salesforce controller extension" and read. – Keith C Jun 2 '15 at 10:52
  • and 2nd thing to read about is JSON serialization and de-serialization – curious_techy Jun 2 '15 at 11:15
  • @KeithC thanks for the answer. Can you give some good examples for this please – ihssan Jun 2 '15 at 11:37
  • @ihssan You will find examples via Google. – Keith C Jun 2 '15 at 12:16
  • the proble is that i need to pass a parameter to the extension method which will be the field of my custom object, and i don't know how to do that – ihssan Jun 2 '15 at 12:17

You can add logic in a controller extension and a controller extension can directly reference the object loaded by the standard controller:

public class MyControllerExtension {

    private final File_Uploaded__c fileUploaded;

    public MyControllerExtension(ApexPages.StandardController sc) {
        this.fileUploaded = (File_Uploaded__c) sc.getRecord();

    private void someMethod() {
        fileUploaded.SomeField__c = 'xyz';
  • that's the last thing i need to know : how can i reference the object loaded by the standard controller within my extension? – ihssan Jun 2 '15 at 13:23
  • Added that. Please spend some time using e.g. Salesforce's workbooks to learn more before you post further questions. – Keith C Jun 2 '15 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.