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
Beto Carvalho 11Beto Carvalho 11 

How do I remove comma at the end of a string when using <apex:repeat> in Visualforce email template? (parsing)

I have a Visualforce email template based on Opportunity. In it I want to incorporate all the Opportunity Team Members whose Member Role = XYZ, say, "Sales Engineer". The following code works splendidly...
<b>Sales Engineers:</b>
     <apex:repeat value="{!relatedTo.OpportunityTeamMembers}" var="oppTeam">
          <apex:outputText rendered="{!oppTeam.TeamMemberRole ='Sales Engineer'}">
          {!oppTeam.Name}, 
          </apex:outputText>
     </apex:repeat>
Except that it (obviously) appends comma + space to each repeat, leaving a trailing ", " at the end:
 
Sales Engineers: Maggie Simpson, Krusty the Clown, 

Where I want:
 
Sales Engineers: Maggie Simpson, Krusty the Clown
 
(i.e. with no ", " at the end). There's probably more than one way to do this, but I've reached the end of my coding knowledge at this point. Ideas?
Agustin BAgustin B
Hi Beto, you could do this as it is not standard in visualforce this functionality: https://developer.salesforce.com/forums/?id=9060G0000005WMUQA2
There is an idea raised to incorporate a separator in visualforce: https://success.salesforce.com/ideaView?id=08730000000YIuvAAG
If it helps please like and mark as correct, it may help others.