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
arundevarundev 

Read and use Values fron Form Fields in Apex Class

I'm creating an Apex class in which I need to read an Account Name slected by user. the issue is i am not able to find a way to read form field values. I know we can read the url parameters in Apex classes but i need to read the sleceted account name on the form in my apex code. can anyone help me achieve this? thanks.
arundevarundev
to be more precise. I cannot use to read value. I want to pass value from an from the form into my controller class.
GhanashyamGhanashyam
In your custom controller write the following....
 
Account acc;
public yourcontroller(ApexPages.StandardController controller)
    {
        acc = (Account) controller.getRecord();
       
    }
 
 
For eg, if the name of the form field is account_type, then you can access this value in the custom controller class by the notation acc.account_type
 
 
Hope that helps