+ Start a Discussion

Passing CUSTOM parameters to VF Email Template/Controller


I have a complex situation that I am trying to resolve.  We have a custom email service that takes emails and plops them onto Tasks in SF.com (with the email Subject being the Subject of the task and the email Body being the task Description.  What is NOW needed is a way to send a REPLY email from this task.  I know that I can do a URL hack to a an email template and just have merge fields in the template, but I am having trouble getting the VF template to actually reference the task and pull in the Description and Subject of the task into the email fields.  

The issue is that the email I am sending can't be related to the Task itself (system won't let it), so instead it is related to the record the task is related to the tasks WhatID.  So basically, in the URL hack I am passing {!Task.WhatID} as the p3_lkid.  I have tried passing the relatedTo parameter directly from the   But I am thinking that the p3_lkid is the record that a VF page uses to find the "RelatedTo" record is that correct?

Is there any way I can pass the ID of the task into the URL of the custom button and then make that be the "RelatedTo" that the VF page uses?  Do I need to build a custom component/controller instead?  If so how do I reference the Task ID from the parameter, initial tests shows that the VF page doesn't like any custom parameters, does that change once this is in context of a controller?

Hope that all makes sense.

Jeremy Stender