I have always the same problem when I use apex: repeat
the question is how or where do we find/write the API name for a plural Label .
I had the same case before with BC (Purchase order) and BC Line Items : 2 objects that I have created .
after testing I found the solution here : BC case
on the BC Object where API Name: BC__c Plural Label : BC (Purch. Orders) on the BC Line item Object , we have on Custom fields : BC ( BC_c) as a
Master-Detail(BC (Purch. Order))
and
Plural Label : BC Line Items API Name BC_Line_Item__c
so following the solution on the first link The apex repeat works after doing :
<apex:repeat var="opp" value="{!relatedTo.BC_line_items__r}"> </apex:repeat>
now my problem is on Sales Order Level and Sales Order Linte Item . Plural Label : Sales Orders API Name Sales_Order__c
and on sales Order Line Item :
Plural Label Sales Order Line Items
API Name Sales_Order_Line_Item__c
Sales Order (Sales_Order__c) Master-Detail(Sales Order)
when I tested it in different way by writing :
<apex:repeat var="opp" value="{!relatedTo.Sales_order_line_items__r}">
or <apex:repeat var="opp" value="{!relatedTo.Sales_Order_Line_Item__r}">
there is an error Error: Invalid field Sales_order_line_items__r for SObject Sales_Order__c
thanks in advance for your response
s
appended to its name. A custom object would get the__r
depending on the context. If someplace in your code, you've isolated the object to where it's now purely that object, it then goes back to__c
, but if you're iterating from a query on the original object and it's a related object, it would have the__r
.