2

I am having a little trouble sending an email to a lead using a template when an Event of type visit is created and again the day before the event. I can't use a workflow because ActivityDate is not available to be referenced. Also not sure how the lead's email will be determined when sending the email. I would like an example of workflow to do this. Or perhaps Is there a a good way to go about this? Maybe a trigger. But the setTargetId of Messaging.SingleEmailMessage does not seem to support event. Any suggestion on how I should approach this? Examples would be great.

Template

    <messaging:emailTemplate subject="Hello" recipientType="Lead" relatedToType="Event">
    <messaging:htmlEmailBody >
      <p>This is a reminder about your visit on <strong>{!relatedTo.ActivityDate}</strong></p> 
      <p>Please use the details below as a reminder of your visit </p> 
      <p><strong>Location:</strong> {!relatedTo.Location} </p>  
     <p>Sincerely,</p>
     <p>{!relatedTo.Owner.Name} </p>
    </messaging:htmlEmailBody> 
    </messaging:emailTemplate>

1 Answer 1

1

You can use setTargetObjectId to the contact and setWhatId to the event in the trigger.

You must log in to answer this question.

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