• manumolu
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies

Hi ,

 

I am trying to create a visualforce template on an Task to send email to Users when insertion of task happens (used a trigger).

Please find the code as  of the visualforce template referred by the trigger as below :

<messaging:emailTemplate subject=" Task Created" recipientType="User" relatedToType="Task" >
<messaging:htmlEmailBody >
 <html>   
  <body>
 
   Task Status      :  {!relatedTo.Status}<br/>
   Task Subject     :  {!relatedTo.Subject} <br/>
   Task Type        :  {!relatedTo.Type} <br/>
   Task Description :  {!relatedTo.Description}<br/>
   Polos Order      :  {!relatedTo.Order__c} <br/>  
   Task id          :  {!relatedTo.id}<br/>
   
  <apex:outputLink value="/{!relatedToid}">
         Please click on link to View task in salesforce!
  </apex:outputLink>
  </body>
 </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

Please Note,I have to  put a link(URL) of the Task. In the email to be sent so that the user receiveing it can click on the link and open up the task view.

There are two issues that I am facing  :

 

1)  All the task (relatedTo) merge fields are coming balnk in the email sent to users.

 

2) I want to use URLFOR function with the email template for outputlink but this seems to be thoring an exception : invalid paramater for URLFOR

<apex:outputLink value="{!urlFor($Action.Task.View, relatedTo.id)}">

 

 

PS :

1) I cannot seem to use the visualforce component for the same becoz I am not getting relatedTo.Id to pass to VF component.

2)Oddly this is happening only when actual trigger is fired and not when I click on send test and verify merge fields.

 

Could some body please help me with this issue.

Thanks in advance for help!!!