0

When viewed in the UI, my email template shows the following subject:

Sample

When running a query, my email subject shows

enter image description here

Why is the query returning a different result then what is displayed in the UI?

2

As it turns out, with Visualforce email templates, if you edit the subject in the code:

<messaging:emailTemplate subject="Test Subject" recipientType="Contact" relatedToType="Account">

The change reflects in the UI and in the emails actually sent out, but it does not reflect in the SOQL query. it seems that while most of SF is smart enough to look to the code for the subject, the database is never actually updated.

  • I always wondered about this as 9 times out of 10, one defines the subject in the markup so one can use merge fields - I would leave Subject in the UI blank – cropredy Aug 27 at 1:06
  • Leaving that blank would mean queries return no subject. I started trying to write out why we needed the query to be accurate but it's too long for a comment :) but a blank UI subject would not work for us. – gNerb Aug 27 at 14:36
  • Your use case may be different as I've only queried based on developer name as it is more 'durable' – cropredy Aug 27 at 14:37
  • The query is based on folder name, we use the subject to compare to task subjects to identify tasks associated to templates of a given folder for business process automation, the code that actually sends out the email is generic and widely used so we didn't want to add it there. – gNerb Aug 27 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.