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
SBKSBK 

Custom controller & ApexPages.StandardController

I have a custom object and I want to implement add, update, delete operations on my custom controller.

 

Questions:

 

1. I am not using any of the standard objects, so I do not have to extend any of the standard controllers right?

 

2.  How will I get access to the StandardController in my custom controller. The reason I need the StandradController is to take advantage of the getRecord() and save() function it offers.

 

3. For some reason this code does not work..

 

 

public with sharing class MyController {

public MyCustomObject__c myCustomObject {get;set;}

public MyController() {}

 

pulic PageReference add() {

try {

insert myCustomObject;

} catch (Exception ex) {

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()));

return null;

}

return null;

}

}

 

 There is no exception thrown in my VisualForce page and the record does not insert as well.

 

  Any help in this regard would be appreciated. 

 

Best Answer chosen by Admin (Salesforce Developers) 
SBKSBK

It was one of the security issues, the field did not have the permission set.

 

Not sure why there was no exception...