function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

<apex:repeat> issue

Hi everybody,


My opportunity has a master-detail to a custom object called Opportunity.

i tried this

<apex:repeat value="{!Opportunity.Payment__c}" var="line"


but it's not working.



Best Answer chosen by Admin (Salesforce Developers) 
Did you check what is the child relationship name you have provided ??

All Answers

Ranjeet Singh (SFDC Developer)Ranjeet Singh (SFDC Developer)

Repeat tag always work with collection and iterate the value and show according to the requirement:


<apex:repeat value="{!Account}" var="var1">






// You can see the Name vlaue of all available Account in the organization.



So we can't use record relation??

I  already did in an other visual force page with the repeat tage on the OpportunityLineItem so far it was it's working.

So i was thinking that i can do the same on the payment object with the Opportunity.


Instead of providing the API name of your custom object , you need to provide the relationship name that you have provided and also it should end with __r .


I tried it to :


<apex:repeat value="{!Opportunity.Payment__r}" var="line">


but i got the error below:


Save error: Invalid field Payment__r for SObject Opportunity


and the API Name isPayment__c

Did you check what is the child relationship name you have provided ??
This was selected as the best answer

how stupid am i ....THANKS




i'am having the same issue and just can't figure it out.


i only want to repeat a field of each opportunities on a visualforcepage.


The custom field(rich text) is menus__c.


and my visualforce code is the follwing ;


<apex:repeat value="{!Opportunity.menus__c}" var="Line">


i have also tried :


<apex:repeat value="{!Opportunity.menus__r}" var="Line">


But i must be missing something....


Would you have any idea?


Thank you in advance.