Please check the below code.The below code display Account related contact and opportunities when you select a particular account name. Based on your requirement you can change the query.
public with sharing class AccContact {
public list<contact> conlst { get; set; }
// public contact c { get; set; }
/* public void getSelacc() {
}*/
public list<account> accconts1 { get; set; }
public PageReference selacc() {
string getid=apexpages.currentpage().getparameters().get('conlst');
accconts1=[select id,name,(select id,lastname from contacts) ,(select name from Opportunities ) from account where id=:getid ];
system.debug(accconts1);
return null;
}
public List<Account> acclst { get; set; }
public AccContact (){
acclst=[select id,name from account ];
system.debug(acclst);
}
}
Hope this helps you!
Please mark it as Best Answer if my answer was helpful. It will make it available for other as the proper solution.
Please check the below code.The below code display Account related contact and opportunities when you select a particular account name. Based on your requirement you can change the query.
public with sharing class AccContact {
public list<contact> conlst { get; set; }
// public contact c { get; set; }
/* public void getSelacc() {
}*/
public list<account> accconts1 { get; set; }
public PageReference selacc() {
string getid=apexpages.currentpage().getparameters().get('conlst');
accconts1=[select id,name,(select id,lastname from contacts) ,(select name from Opportunities ) from account where id=:getid ];
system.debug(accconts1);
return null;
}
public List<Account> acclst { get; set; }
public AccContact (){
acclst=[select id,name from account ];
system.debug(acclst);
}
}
Hope this helps you!
Please mark it as Best Answer if my answer was helpful. It will make it available for other as the proper solution.
Please check the below code.The below code display Account related contact and opportunities when you select a particular account name. Based on your requirement you can change the query.
Visualforce Page
Controller
Hope this helps you!
Please mark it as Best Answer if my answer was helpful. It will make it available for other as the proper solution.
Best Regards,
Jyothsna
All Answers
<apex:pageBlock >
You're looking at some related lists for {!account.name}:
</apex:pageBlock>
<apex:relatedList list="Opportunities" />
<apex:relatedList list="Contacts">
<apex:facet name="header">Titles can be overriden with facets</apex:facet>
</apex:relatedList>
<apex:relatedList list="Cases" title="Or you can keep the image, but change the text" />
</apex:page>
---------------------
thanks,
Priyanka.N
Please check the below code.The below code display Account related contact and opportunities when you select a particular account name. Based on your requirement you can change the query.
Visualforce Page
Controller
Hope this helps you!
Please mark it as Best Answer if my answer was helpful. It will make it available for other as the proper solution.
Best Regards,
Jyothsna