You need to sign in to do that
Don't have an account?
Support 3743
What do the components of apex:repeat mean and how do I write a Visual force email template?
Hi everyone, I'm a complete newbie to Apex and I'm recently writing an email template that sends out all of the opportunities related to a specific account name. However I don't fully understand what <apex:repeat> does.
In <apex:repeat var="op" value="{!relatedTo.Name}">, what does "var" refer to and what does "value" refer to? Does this create a loop that iterates through all of the records in relatedTo that have Name equal to value?
Please help me with this! Thank you so much!
In <apex:repeat var="op" value="{!relatedTo.Name}">, what does "var" refer to and what does "value" refer to? Does this create a loop that iterates through all of the records in relatedTo that have Name equal to value?
Please help me with this! Thank you so much!
You can assume that: apex:repeat as a for loop in programming which iterates over the list of values (value="{!relatedTo.Name}", iterates over name coming from relatedTo list), var is same like loop veriable to iterate the list one by one, below is the simple example of iterating the list of account and printing the name of each account:
In value="{!accounts}", accounts is a list of account record which we are iterating through a.
Mark solved if it does help you.
All Answers
You can assume that: apex:repeat as a for loop in programming which iterates over the list of values (value="{!relatedTo.Name}", iterates over name coming from relatedTo list), var is same like loop veriable to iterate the list one by one, below is the simple example of iterating the list of account and printing the name of each account:
In value="{!accounts}", accounts is a list of account record which we are iterating through a.
Mark solved if it does help you.
You can find the name on field it-self. Like : Contact is related to account, so contact will have lookup field AccountId, when you click on it, you will get the relationship field name. For custom fields, relationship name is usally appended by __r.
Screenshot of relationship field on Contact:
Mark solved if it does help you.