You need to sign in to do that
Don't have an account?
Dilyan Dimitrov
Pass a parameter from one controller to another
Hello,
I would like to know how to pass a parameter from one cotroller to another controller?
For example I am trying to pass the accountId value by using the following code in the first controller
I would like to know how to pass a parameter from one cotroller to another controller?
For example I am trying to pass the accountId value by using the following code in the first controller
public PageReference goToNextPage() { PageReference pageRef = Page.MyNextPage; pageRef.getParameters().put('AccId', accountId); return pageRef; }
and according to the log file
DEBUG|pageRef System.PageReference[/apex/newconvtomerch?AccId=00156000002zGVsAAM
the value I need is added to the AccId.
The problem is that by using the following code
String AccountId = ApexPages.currentPage().getParameters().get('AccId');
I can not get the AccId value in the second controller which actually is the Extension controller
Could you please advise how to fetch the AccId value I need from the first controller?
Regards,
Dilyan
Instead, you can use <apex:param> tag to pass values to a controller variable. Use Value attribute to get the value from one controller and use assignto attribute, to assign that value to another controller.
Have a look at the following
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_param.htm
https://developer.salesforce.com/forums/?id=906F0000000968NIAQ