function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
public class accountContactInformation { list<AccountWrapper> wraplist=new list<AccountWrapper>(); public accountContactInformation() { Map<Id, AccountWrapper> accMap=new Map<Id, AccountWrapper>(); for(account a:[SELECT createdby.name,CreatedbyID,Account.Name,(SELECT name,Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account]) { AccountWrapper accWrap=accMap.get(a.CreatedByid); // AccountWrapper accWrap=accMap.get(a.CreatedBy.name); if (null==accWrap) { accWrap=new AccountWrapper(); accMap.put(a.CreatedByid, accWrap); accWrap.userid=a.CreatedByid; // accMap.put(a.CreatedBy.name, accWrap); accWrap.username=a.CreatedBy.name; } accWrap.accounts.add(a); } wrapList=accMap.values(); } public list<AccountWrapper> getaccounts() { return wraplist; } public class AccountWrapper { public id userid {get; set;} public string username {get; set;} public List<Account> accounts {get; set;} public AccountWrapper() { accounts=new List<Account>(); } } }
<table> <apex:repeat value="{!accs}" var="acc"> <tr> <td><apex:outputText value="{!acc.Name}"/></td> <apex:repeat value="{!acc.Contacts}" var="cont"> <td><apex:outputText value="{!cont.Name}"/></td> </apex:repeat> </tr> </apex:repeat> </table>
<apex:page standardController="Account"> <h1>Account : </h1>{!Account.Name} <apex:pageBlock title="Contacts"> <apex:pageBlockTable value="{!Account.Contacts}" var="con" columns="2" title="Contacts" headerClass="Contacts"> <apex:column value="{!con.FirstName}"/> <apex:column value="{!con.LastName}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
Try this:
And VF page:
Thanks
Vinod
All Answers
Please find below code :
PLease mark as best answer if helped.
Regards,
Ramakant
Try this:
And VF page:
Thanks
Vinod