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

Explain StandardController Class

In the document I can't understand.(The only time it is necessary to refer to a StandardController object is when defining an extension for a standard controller. StandardController is the data type of the single argument in the extension class constructor.)
can you explain this code.
what will I get?
ApexPages.StandardController sc = new ApexPages.StandardController(Account);
Best Answer chosen by Sakthidasan
Mahesh DMahesh D
Whenever you use the Extension Controller and if it is extending from Standard Controller then Salesforce expects us to write a Constructor with Standard Controller as a parameter so that using its object we can get the current record like

Account acc = (Account) controller.getRecord();

By extending the Standard Controller, we can use the standard CRUD (Create, Retrieve, Update, Delete) operations and also we can write our own custom business logic.