+ Start a Discussion

Approval History info in Visualforce Email Template

Getting all the useful info from approval history. I can get most, but a couple elude me - like the name of the Approval step! See:
<messaging:emailTemplate subject="Lead Final Approval" recipientType="User" relatedToType="Lead">

<messaging:htmlEmailBody >

//lots of other Lead fields

<p><b>Approval History:</b></p>
<table border="1" >
    <apex:repeat var="cx" value="{!relatedTo.ProcessSteps}">
             <td>Assigmed to: {!cx.OriginalActor.name}</td>
             <td>Actual Approver: {!cx.Actor.name}</td>
             <td>Step Name-ID(cx) : {!cx}</td>
            <td>Step Status: {!cx.StepStatus}</td>
            <td>Approvals Completed:{!cx.ProcessInstance.CompletedDate}</td>
<p />

The big problem line is <td>Step Name-ID(cx) : {!cx}</td>
It produces an id with an 04h prefix, so it's the Step, but how to the the NAME of the step?
I am just getting output like this for that line:Step Name- : 04hq0000000GkgFAAS
{!cx.name} for example does not compile. Thanks
Hi ,
What actually you want to display in template in place of Id ,because in ProcessInstance and steps both do not have any Name field .That ia the main cause it is ahowing you error .

Could you please tell what exactly you wnat to display .
I want to see the name of the approval step to match the approver's name and date I am getting. 
Hey ,
Name in the sense whether it is submitted ,approved ,rejected ? If yes then you can get from StepStatus ,however submitted will display as started if you want you can display Submitted in place of started rest will be same .

No, that would be status. I mean name of the Step - Initial Approval, Business Manager, etc. 
The names under the Name column in the middle below - 
the name of the approval step - see Name column
This image is the  approval steps in your appoval process .Internally salesforce is storing data in ProcessInstance and ProcessInstanceSteps objects .You can query and check in workbench .