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

how to display value from parent & child both filed
I have parent to child query result stored in map now i want to display value from both obj in VF email template using apex component but getting error
APEX CLASS LOGIC :
public Map<Id, List<SObject>> getLocation()
{
Map<Id, List<SObject>> locationadd;
for (account acc :[select id,Phone,(select City__c,State_Province__c,ZipCode__c FROM Addresses__r) from account where id ='xxxxxxxxxxxx'])
{
locationadd.put(p.Id, Addresses__r);
}
return locationadd;
}
APEX COMPONET:
<apex:repeat value="{!Location}" var="acc4">
<TR>
<TD>City</TD>
<TD>{!Location[acc4].City__c}</TD>
</TR>
<TR>
<TD>City</TD>
<TD>{!Location[acc4].Phone}</TD>
</TR>
</apex:repeat>
APEX CLASS LOGIC :
public Map<Id, List<SObject>> getLocation()
{
Map<Id, List<SObject>> locationadd;
for (account acc :[select id,Phone,(select City__c,State_Province__c,ZipCode__c FROM Addresses__r) from account where id ='xxxxxxxxxxxx'])
{
locationadd.put(p.Id, Addresses__r);
}
return locationadd;
}
APEX COMPONET:
<apex:repeat value="{!Location}" var="acc4">
<TR>
<TD>City</TD>
<TD>{!Location[acc4].City__c}</TD>
</TR>
<TR>
<TD>City</TD>
<TD>{!Location[acc4].Phone}</TD>
</TR>
</apex:repeat>
please use locationadd.put(p.Id, acc.Addresses__r) instead of locationadd.put(p.Id, Addresses__r);
Please let me know if you need further help
Please Mark it As Best Answer If it Helps
Regards
Mukesh
Hi Santosh,
You are filling the map in the wrong way. You can fill the map like this.
Please follow the below link it will solve your all queries related to VF page
http://bobbuzzard.blogspot.com/2011/04/edit-parent-and-child-records-with.html
Please mark it as Best Answer so that other people would take reference from it.
Thank You!