You need to sign in to do that
Don't have an account?
How To pass AccountId from Apex class to Vf page
Hi All,
VisualForce Page:
We need to specify the ID of a particular account :https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.
After you add in an account ID,
My page should display as follows:

here I dnt want pass url like this:https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.
here I want pass AccountId from Apex class to VF Page.
Thanks
VisualForce Page:
<apex:page standardController="Account" showHeader="true" tabStyle="account" > <style> .activeTab {background-color: #236FBD; color:white; background-image:none} .inactiveTab { background-color: lightgrey; color:black; background-image:none} </style> <apex:tabPanel switchType="client" selectedTab="tabdetails" id="AccountTabPanel" tabClass='activeTab' inactiveTabClass='inactiveTab'> <apex:tab label="Details" name="AccDetails" id="tabdetails"> <apex:detail relatedList="false" title="true"/> </apex:tab> <apex:tab label="Contacts" name="Contacts" id="tabContact"> <apex:relatedList subject="{!account}" list="contacts" /> </apex:tab> <apex:tab label="Opportunities" name="Opportunities" id="tabOpp"> <apex:relatedList subject="{!account}" list="opportunities" /> </apex:tab> <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct"> <apex:relatedList subject="{!account}" list="OpenActivities" /> </apex:tab> <apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt"> <apex:relatedList subject="{!account}" list="CombinedAttachments" /> </apex:tab> </apex:tabPanel> </apex:page>
We need to specify the ID of a particular account :https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.
After you add in an account ID,
My page should display as follows:
here I dnt want pass url like this:https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.
here I want pass AccountId from Apex class to VF Page.
Thanks
Thanks for immediate responce..now its working fine no issues.
I got error like :System.QueryException: List has no rows for assignment to SObject
I fixed thir error :
Thanks,
Rockzz
All Answers
public String id{get;set;}
// In your constructor
id= con.getRecord().id; // con= instance of ApexPages.standardController
I am getting error like this:Id value is not valid for the Account standard controller
Thanks
I tried this way also but I am getting compile error like below attached image:
below line:
Thanks
change from
id=(Account)stdController.getRecord().id;
to
id = controller.getId();
pos=(Account)stdController.getRecord();
id = pos.id;
I tried this:id=controller.Id;
I am getting below compile error:
And I triend this one also:
pos=(Account)stdController.getRecord();
id = pos.id;
I am getting below error:
Thanks
id=controller.Id;
it is
id=controller.getId();
for 2nd one,try querying id field
id = [select id from Account where id=:pos.id].id;
I have tried both but still I am facing same issue:
Thanks
If you are still not getting,I would suggest to debug the logs and see what's happening there !!
Shouldn't you be doing pos=(Account)controller.getRecord(); and not
pos=(Account)stdController.getRecord();
since controller is the name of the ApexPages.StandardController object.
Lakshmi.
My Vf page not calling my extension class (tabPanelExt class ) and its method..
This is my debug log:
can you please check my VF page ..
Thanks
Also,Lakshmi is right,I just saw , you should be using
pos=(Account)controller.getRecord();
From the code above I understand that what you want to do is load the page with a tabbed view of the related lists.
You wouldn't need to do a redirect in recordDetails() method called from the action tag for the same.
You can change the code as given below to make it work :
public PageReference recordDetails()
{
PageReference requestPage = new PageReference('/apex/tabPanelPage?id='+id);
System.debug('***requestPage ***'+requestPage );
return null;
}
If the action method returns null, the page simply refreshes.
Lakshmi.
still i am getting same error:Id value is not valid for the Account standard controller
System.debug('***acc ***'+acc);
and
System.debug('***id***'+id);
Hope you are specifying the correct page name in the address bar -
:https://na1.salesforce.com/apex/tabPanelPage?id=<Valid account id>
(Go to the account which you want to view as tabbed and get the account id from the url)
Lakshmi.
Thanks for immediate responce..now its working fine no issues.
I got error like :System.QueryException: List has no rows for assignment to SObject
I fixed thir error :
Thanks,
Rockzz
it's really helpful for me thanks for your Support .
Thanks,
Rockzz