When I include the following code inside the "subject" of my visualforce email template I can't use "send test and verify merge fields" - the message 'The template does not have a controller that can be selected for preview.' appears.
{! IF( AND(relatedTo.event__r.start_date__c != null, relatedTo.event__r.end_date__c != null,
(DAY(relatedTo.event__r.start_date__c) > DAY(relatedTo.event__r.end_date__c))),
CASE(MONTH(relatedTo.event__r.start_date__c),
1, ' January',
2, ' February',
3, ' March',
4, ' April',
5, ' May',
6, ' June',
7, ' July',
8, ' August',
9, ' September',
10, ' October',
11, ' November',
12, ' December',
''
)
,'')}
In the email subject I want to get:
Confirmation - Event, 14-15 September, City, Country
(if event date is 14-15 september)
OR if the dates go over the month 29 Sep - 1 October
Confirmation - Event, 29 September - 1 October, City, County.
Full Code (only the above seems to be causing an issue):
<messaging:emailTemplate subject="Confirmation - {! relatedTo.event__r.name },
{! DAY(relatedTo.event__r.start_date__c)}
{! IF( AND(relatedTo.event__r.start_date__c != null, relatedTo.event__r.end_date__c != null,
(DAY(relatedTo.event__r.start_date__c) > DAY(relatedTo.event__r.end_date__c))),
CASE(MONTH(relatedTo.event__r.start_date__c),
1, ' January',
2, ' February',
3, ' March',
4, ' April',
5, ' May',
6, ' June',
7, ' July',
8, ' August',
9, ' September',
10, ' October',
11, ' November',
12, ' December',
''
)
,'')}
-{!DAY(relatedTo.event__r._end_date__c)}
{!CASE( MONTH(relatedTo.event__r.end_date__c),
1, 'January',
2, 'February',
3, 'March',
4, 'April',
5, 'May',
6, 'June',
7, 'July',
8, 'August',
9, 'September',
10, 'October',
11, 'November',
12, 'December',
''
)
},
{! relatedTo.event__r.city__c },
{! relatedTo.event__r.country__c }
" recipientType="User" relatedToType="Participant__c" >
relatedTo
?