You need to sign in to do that
Don't have an account?
Visualforce Email Template Syntax error - but can't figure out where
I'm trying to create a VF template to email Clicktools survey invitations. Clicktools allows for passing values to the survey as parameters on the URL. I was able to succesfully deploy this survey with this URL structure yesterday using Clicktools' email template builder. (Yes, I could create URLencoded formula fields on the Contact, but dangit, I want to get the VF to work!)
While I can't be sure, since all I'm getting is a general "Syntax Error" message when I try to save, I think the problem must be in the URL building, and most likely the 3rd parameter. That parameter in the URL feeds a multi-line Text question in Clicktools, and should be the concatenated Salutation, First & Last;; Title; Account Name; Contact Email, separated by pipes, eg:
&q3=Mr.%20Thomas%20Taylor|Director%20of%20IT|Greater%20Phila%20Cultural%20Alliance|foobar@philaculture.org
<messaging:emailTemplate subject="Complete the Community Engagement Questionnaire" recipientType="Contact" relatedToType="Account" > <messaging:htmlEmailBody> <html dir="ltr"> <head> <title></title> </head> <body> <table width="100%" border="0"> <tbody> <tr height="91px" bgcolor="#4F78D6"> <td align="right"> <apex:image value="{!$Resource.CALogoWhOnB}" /></td> </tr> </tbody> </table> <p>Dear {!recipient.FirstName},</p> <p>The Cultural Alliance needs your help. We know that arts and culture play a vital role yadda yadda yadda </p> <p>The survey takes 15 minutes to complete. To begin, click: <apex:outputLink value="http://www.clicktools.com/survey?iv=123idnumber456"> <apex:param name="q1" value="{!recipient.Id}" /> <apex:param name="q2" value="{!relatedTo.Id}" /> <apex:param name="q3" value="{!URLENCODE({!recipient.Salutation}+' '+{!recipient.FirstName}+' '+{!recipient.LastName})}|{!URLENCODE({!recipient.Title})}|{!URLENCODE({!relatedTo.Name})}|{!URLENCODE({!recipient.Email})}" /> Community Engagement Questionnaire </apex:outputLink> . Please complete the questionnaire by <b><u>February 4<sup>th</sup></u> </b>.</p> <p>Couple more paras of HTML below.</p> </body> </html> </messaging:htmlEmailBody> </messaging:emailTemplate>
Many thanks for any guidance you're willing to offer this aspiring VisualForce builder!
There are syntax errors in your UrlEncode calls. You cannot "nest" the {!...} markers. Everything inside is an expression.
So you need something like
All Answers
There are syntax errors in your UrlEncode calls. You cannot "nest" the {!...} markers. Everything inside is an expression.
So you need something like
Yes - thank you! I got a similar reply on a mailing list I asked as well, but you answered here before I got a chance to update. Actually, with that knowledge, I went ahead and used a single URLENCODE call for the whole thing: