+ Start a Discussion
gtuerkgtuerk 

Using out-of-the box Approval links within Custom Visualforce Email templates

There has to be an easy solution for this but I can't find it...  If I don't specify an Approval Assignment Email template in one of my Approval processes, when new Approvers are assigned they get a not-so-pretty (but functional) email that tells them to click on a link to approve the item.  The email looks like below with a dynamically generated hyperlink:

Force.com Sandbox

Joe Schmo has requested your approval for the item below.

https://{!tokenizedDomain}/p/process/ProcessInstanceWorkitemWizardStageManager?id={!someRowID}

Please click this link to approve or reject this record.

I have a visualforce email that I want to target to certain users based on characteristics of the item being approved.  I'd really like to use the default sending of this email based on the approvers that are conditionally assigned as that logic is in place in approval process steps.  I can't figure out how to get the track-back link to appear on my visualforce page (which is 'Related To' a Custom Object).  Can someone give me an idea?  The salesforce training/documentation is a little unclear

"If the email template you choose contains approval merge fields named {!ApprovalRequest.field_name}, these fields will return values only when that email template is used as the approval assignment template. If you use the template for any other email alert action—in either workflow rules or approval processes—the merge fields will return a null value."
ncurhamncurham

Similar scenario - want to use a VF email template in an approval process to show details of the custom object being approved and the related custom objects that provide more detail.  How can I create a link directly to the Approvals page?  I can't work out how to establish the ID for the end of the URL.

 

Thanks,

 

Neil

JAW99JAW99
You need to use a custom approval process. The separation between the standard and custom process I think is junk b/c they're so different. It creates a mess if you want to transition from the standard to a custom and you've got objects in approval. The standard is junk b/c you have no access to the notification template.
Keith654Keith654

The only way I can see to get the necessary id for the hyperlink is to create the process programmatically and obtain the value by invoking the Approval.ProcessResult.getNewWorkitemIds() method. But that seems awfully hard for something that (I assume) is frequently needed.

 

What am I missing here?

 

Thanks,

Keith