You need to sign in to do that
Don't have an account?

how do you call controller class methods in another class
Hi,
I have a controller class A which has two methods ,first method which fetches ContactID and 2nd method fetches the Module Id.
I am creating a page whose controller class B will fetch values from Methods of Class A.
Question-1 : How to call methods of controller A in controller B.
Should we write this in the constructor of the new controller B or a separate method inside it to call the Controller class A methods.
Once i fetch the values , i need to create a record in a junction object which will associate contactId and Module Id(which is fetched from the methods). Here id the Module is 1,2 only then create record in junction object else not required.How shall we put this logic.
Kindly help as i am new to this.
I have a controller class A which has two methods ,first method which fetches ContactID and 2nd method fetches the Module Id.
I am creating a page whose controller class B will fetch values from Methods of Class A.
Question-1 : How to call methods of controller A in controller B.
Should we write this in the constructor of the new controller B or a separate method inside it to call the Controller class A methods.
Once i fetch the values , i need to create a record in a junction object which will associate contactId and Module Id(which is fetched from the methods). Here id the Module is 1,2 only then create record in junction object else not required.How shall we put this logic.
Kindly help as i am new to this.
A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend. In the below code i am overrolading the constructor to call the StandardController extension class from other class
Extension
Helper CLass
Case 2 : Lets Say You are using Controller and need to call from the Other helper class or apex class
helper class
Note that you can use the code without overriding the constructor