function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John Neilan 2John Neilan 2 

Processinstance in VF Page

Hello,

I have a Visualforce page constructed on a custom object.  I am using the standard controller for that object.  I also have an Approval Process associated with the object.  I am able to pull in the approval history with the <apex:relatedList List="ProcessSteps"> function.  However, I would like to customize the related list to make it a bit more user-friendly. I know I can use <apex:facet> to control the header, footer, and body, but is there any way to pull in the different columns of the approval history?  (e.g., {!processinstance.Status}, {!processinstance.AssignedTo}, etc.)
Best Answer chosen by John Neilan 2
BharathimohanBharathimohan
Hello John,

<apex:relatedList> does not allow customizations except changing the size of record display.
Displaying records in <apex:pageblocktable> using a list from apex class querying process instance is the only solution that allows customizations.

Let me know if you found anyother alternative.


Regards,
Bharathimohan Rammaurthy
Salesforce For All (http://salesforceforall.blogspot.com/)



 

All Answers

BharathimohanBharathimohan
Hello John,

<apex:relatedList> does not allow customizations except changing the size of record display.
Displaying records in <apex:pageblocktable> using a list from apex class querying process instance is the only solution that allows customizations.

Let me know if you found anyother alternative.


Regards,
Bharathimohan Rammaurthy
Salesforce For All (http://salesforceforall.blogspot.com/)



 
This was selected as the best answer
Jai ChaturvediJai Chaturvedi
Hi,

You can use <apex:pageBlaockTable>, <apex:dataTable> for showing the customize tables.

You can use the following objects to SOQL the Approval Process details.

ProcessInstance
SELECT Id, (SELECT Id, StepStatus, Comments FROM Steps) FROM ProcessInstance
  • This query will query all Approval process and it's Steps
  • Steps is the childRelationshipName for ProcessInstanceSteps
SELECT Id, (SELECT Id, ActorId, ProcessInstanceId FROM Workitems) FROM ProcessInstance.
  • All Appproval process and it's workitem
  • Workitems is the childRelationshipName for ProcessInstanceWorkitem

ProcessInstanceHistory : 
Read Only object. Shows all steps and workitem associated with a ProcessInstance.
  • SELECT Id, (SELECT Id, StepStatus, Comments FROM StepsAndWorkitems) FROM ProcessInstance.
  • StepsAndWorkItems is the childRelationshipName for ProcessInstanceHistory.
ProcessInstanceWorkitem:
  • Manage pending approval request for a user (eg: 2)

ProcessInstanceStep:
  • Query step's and it status in an approval process (Process instance)  (eg: 1)

Reference:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_processinstance.htm
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_processinstancehistory.htm
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_processinstancestep.htm
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_processinstanceworkitem.htm



Thanks
Jai
John Neilan 2John Neilan 2
Thanks.  I figured as much, but thought I would ask.