0

I'm trying to send 3 different email using a single email template and visualforce component. I'm using rendered to display the text in html email vf component based on conditions. However, when I'm trying to add 3 different subject lines in email template subject, it does not let me save and throws and error : 'syntax error'.

I'm not sure what's wrong here. any help would be much appreciated.

Cheers! :)

<messaging:emailTemplate subject="{!If({RelatedTo.order_status__c} =='Cancelled','Revision Required for Trade Event Order : {!RelatedTo.Name}',{!If({RelatedTo.order_status__c} == 'Approval Requested','Approval Requested For : {!relatedTo.Name}','Approved')})}" recipientType="User" relatedToType="GTS3_Trade_Event__c">
<messaging:htmlEmailBody >
<c:TradeEventOrder_CancelAndSubmission tradeEventOrderId="{!relatedTo.Id}"/>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
2
  • What does that 'Syntax error' say? Can you please provide more information by editing your question?
    – SatyaV
    Sep 13, 2018 at 14:49
  • @ArnoldJr. It just says 'Error: Syntax error'.. That's it.. there is no other statement to describe what's not being done the right way. Sep 13, 2018 at 14:50

1 Answer 1

1

The error is that you're using the merge syntax inside of merge syntax.

{!If({RelatedTo.order_status__c} =='Cancelled','Revision Required for Trade Event Order : {!RelatedTo.Name}',{!If({RelatedTo.order_status__c} == 'Approval Requested','Approval Requested For : {!relatedTo.Name}','Approved')})}

Try

{!If(RelatedTo.order_status__c =='Cancelled','Revision Required for Trade Event Order : ' & RelatedTo.Name, If(RelatedTo.order_status__c == 'Approval Requested','Approval Requested For : ' & relatedTo.Name,'Approved'))}

Update

I edited the question a few times to try to make sure I was getting the syntax correct. Hopefully it'll work as it is but if you run into errors with what I posted feel free to add a comment so I can fix it.

2
  • Make sure you accept the answer so others know your issue is resolved.
    – gNerb
    Sep 13, 2018 at 14:56
  • My answer shows you exactly what you need to do already.
    – gNerb
    Sep 13, 2018 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .