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 

Approval Process Fields in VF

Hello,

Does anyone know if it;s possible to pull in Approval Process fields into a custom Visualforce page?  Specifically, I am trying to find the syntax for displaying the Approval Status.  I don't want to include the related list.  Thanks,
Tugce SirinTugce Sirin
//in your controller you can get approval process with this query
//yourobject.Id is going to be Id of the record for the approval process

ProcessInstance pi = [Select Id, Status, TargetObjectId From ProcessInstance WHERE TargetObjectId = :yourobject.Id];
For more information on ProcessInstance class; https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_processinstance.htm

Let me know if this helps.
John Neilan 2John Neilan 2
Thanks.  I'm actually just using the standard controller for my custom object so I was hoping to be able to pull the fields in directly to my VF page.