2

I want to insert this Approval History section on opportunity to my PDF (There`s a pdf button on my opportunity object)..

enter image description here

But what appeared on my pdf [enter image description here

Issue :

  1. How to get every status date?

  2. You can see there`s different "assign to" actor on approval history and pdf. how do i get the right actor?

  3. how to split the value so it will appear in single row?

this is my vf

<div style="">
        <div Style="margin-top:15%; "  ><p Style="font-size:18px;" ><b>
            Approval History
            </b>
            </p>
            <table class="body" style = "text-align: center;font-size:14px; spacing:-1px; border:solid 1px black; ">
            <th style="width:10%; border:solid 1px black;">Date</th>
            <th style="width:6%; border:solid 1px black;">Status</th>
            <th style="width:10%; border:solid 1px black;">Assign To</th>
            <th style="width:10%; border:solid 1px black;">Actual Approver</th>
            <th style="width:15%; border:solid 1px black;">Comments</th>
            <th style="width:10%; border:solid 1px black;">Overall Status</th>


                <tr style="">
                    <td style = " width:10%; text-align:center; font-size:14px; spacing:-1px; border:solid 1px black;">
                        <apex:dataTable value="{!Opportunity.ProcessInstances}" var="piValue">
                        <apex:column value="{!piValue.CompletedDate}" />
                        </apex:dataTable>
                    </td>
                    <td style = " width:10%; text-align:center; font-size:14px; spacing:-1px; border:solid 1px black;">
                        <apex:dataTable value="{!Opportunity.ProcessSteps}" var="stepsValue">
                        <apex:column value="{!stepsValue.StepStatus}" />
                        </apex:dataTable>
                    </td>
                    <td style = " width:10%; text-align:center;font-size:14px; spacing:-1px; border:solid 1px black;">
                        <apex:dataTable value="{!Opportunity.ProcessSteps  }" var="stepsValue">
                        <apex:column value="{!stepsValue.Actor.Name}" />
                        </apex:dataTable>
                    </td>
                    <td style = " width:10%; text-align:center;font-size:14px; spacing:-1px; border:solid 1px black;">
                        <apex:dataTable value="{!Opportunity.ProcessSteps  }" var="stepsValue">
                        <apex:column value="{!stepsValue.Actor.Name}" />
                        </apex:dataTable>
                    </td>
                    <td style = " width:10%; text-align:center;font-size:14px; spacing:-1px; border:solid 1px black;">
                        <apex:dataTable value="{!Opportunity.ProcessSteps}" var="stepsValue">
                        <apex:column value="{!stepsValue.Comments}" />
                        </apex:dataTable>
                    </td>
                    <td style = " width:10%; text-align:center; font-size:14px; spacing:-1px; border:solid 1px black;">
                        <apex:dataTable value="{!Opportunity.ProcessInstances}" var="piValue">
                        <apex:column value="{!piValue.Status}" />
                        </apex:dataTable>
                    </td>
                </tr>    

           </table>
        </div> 
    </div>    
1

The problem that you're having is your Date is defined as using <apex:column value="{!piValue.CompletedDate}" />. If you look at the Object Reference for ProcessInstance The Start Date for ProcessInstance isn't an available field for you to query on. That would be something you'd need to calculate in your controller using the CompletedDate.addseconds(-ElapsedTimeInMinutes) to "back into" to the value of the StartDate.

You'd then need to either:

  • Create an AggregrateResult field for Date that combined both CalculatedStartDate and CompletedDate so the records could be brought down properly from your controller.
  • Replace the null values for the CompletedDates associated with the Statuses you're trying to match the StartDates with that are missing in your table which are likely returned in a query in the controller.
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.