• Hritik Bhardwaj 1
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All, 

Please keep your responses as simple as possible, I am learning :)

I created A Class, A controller, and a VF template to display the approval process details, however... The values returned are UserIDs and GMT time stamp - Additionally I can't seem to get a nice table in my visualforce template it doesn't seem to respect the percentages I give it or setting it to 100%. Image of wants below along with my code.

I assume I need to tell my class to give me the Actorname but thats not one of the values I can pull from = getApprovalSteps not sure how to accomplsih this or do I do this somwhere else? 

Class: 

public class OpportunityApprovalHistoryController {
    public String opptyId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() 
    {if (opptyId != null) {Opportunity quote = 
        
[Select Id, 

(Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, 
IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) 

from Opportunity where Id = :opptyId];

 return quote.ProcessSteps;}
 
 return new List<ProcessInstanceHistory> ();}}

Controller:
<apex:component controller="OpportunityApprovalHistoryController" access="global">

<apex:attribute name="oppId" assignTo="{!opptyId}" type="String" description="Id of the opportunity"/>

<apex:dataTable value="{!approvalSteps}" var="step">

<style></style>

<apex:facet name="caption">Approval History</apex:facet>
<apex:facet name="header">Details</apex:facet>

<apex:column width="20%">
<apex:facet name="header">Date</apex:facet>
<apex:outputText value="{!step.SystemModstamp}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Status</apex:facet>
<apex:outputText value="{!step.StepStatus}"/>
</apex:column>

<apex:column width="20%" >
<apex:facet name="header">Assigned To</apex:facet>
<apex:outputText value="{!step.OriginalActorid}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Actual Approver</apex:facet>
<apex:outputText value="{!step.ActorID}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Comments</apex:facet>
<apex:outputText value="{!step.Comments}"/>
</apex:column>

</apex:dataTable>
</apex:component>

VF Template

<messaging:emailTemplate subject="Opportunity {!relatedTo.Name} Submitted for {!relatedTo.Subscription_Discount_Percent__c}% Subscription Discount" recipientType="User" relatedToType="Opportunity">
<messaging:HtmlEmailBody >

<p>Hello {!recipient.Name},</p>

<p>Opportunity: {!relatedTo.Name} for {!relatedTo.Account.Name} has been submitted for approval: </p>

<html>
<head>
<meta content="text/css;charset=utf-8" http-equiv="Content-Type"/>
<meta name="Template" content="Response"/>
</head>
<body>
<p><b>Approval History</b>

<c:opportunityapprovalhistory oppId="{!relatedTo.Id}" />

</p>
</body>
</html>
</messaging:HtmlEmailBody>
</messaging:emailTemplate>

WHAT I WANT

User full name not ID; Date in this format 5/16/2017 Est, and columns that auto size to the text along with borders on the table. 

User-added image