+ Start a Discussion
AntonyasLenAntonyasLen 

<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.

Anyone?

 

Best Answer chosen by Admin (Salesforce Developers) 
PrakashbPrakashb
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">

 

   {!var1.Name}

 

</apex:repeat>

 

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

 

AntonyasLenAntonyasLen

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.

PrakashbPrakashb

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 .

AntonyasLenAntonyasLen

I tried it to :

 

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

 

but i got the error below:

 

Save error: Invalid field Payment__r for SObject Opportunity

 

and the API Name isPayment__c

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

how stupid am i ....THANKS

iJojoiJojo

Hi, 

 

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">
<tr>
<td>{!Line.menus__c}</td>
</tr>
</apex:repeat>

 

i have also tried :

 

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

 

But i must be missing something....

 

Would you have any idea?

 

Thank you in advance.

 

Jonathan