2

I'm trying to display a parent field value in the subject line of a VisualForce email template and I'm running into problems. The use case is that we're going to fire an email alert that is based on a workflow rule on the child object.

Here's what I've got:

Parent object: Case

Parent object field: Case Number

Child object: n2de__Distribution_log__c

And here's how I've started, but I'm running into an error when saving. What am I missing?

<messaging:emailTemplate subject="Alert: 25 Minutes Before {!relatedTo.Case__r.CaseNumber} Misses Target" recipientType="User" relatedToType="n2de__Distribution_log__c">
<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

The error text is:

Error: Invalid field Case__r for SObject n2de__Distribution_log__c

  • and the error is ...? – cropredy Apr 21 '15 at 19:15
  • Error: Invalid field Case__r for SObject n2de__Distribution_log__c – Charles Naughton Apr 21 '15 at 19:18
2

I spun up Distribution Engine on my Developer instance, and it looks like the field you want is actually n2de__Case__r.

Try {!relatedTo.n2de__Case__r.CaseNumber}

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.