You need to sign in to do that
Don't have an account?
jaw999
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:
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
<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}"> <tr> <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> <td>Process:{!cx.ProcessInstance.ProcessDefinition.name}</td> <td>Comments:{!cx.Comments}</td> </tr> </apex:repeat> </table> <p /> </messaging:htmlEmailBody> </messaging:emailTemplate>
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
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 .
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 .
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 .