If you have one or more approval processes, you may find a requirement to be able to report on records that are pending approval. As well as knowing the records, we probably will want to know who the record has been assigned to for approval, so we can follow up or reassign if the person is not available. If you have a look at the standard reports, you won’t find one that lists pending approvals. Next stop is usually Google, and if you do search for answers on this topic, you will find many people before asking the same question. How can we report on pending approvals?
After reviewing the search results to your query, you will find your way to a Salesforce help link: Fields Available for Approval History Reports
This promises to solve the requirement, with the description of :
If you create a custom report type with Process Instance as the primary object and Process Instance Node as the related object, you can create approval history reports with various combinations of fields that enable you to view a detailed history of executed and in-progress approval processes and their individual steps..
So, next step custom report types. After creating a custom report type, we return to the report builder, and eagerly run our report. He are the results after running the report, where I have filtered the status to only show Pending approval requests.
This looks promising. We can see the 5 pending approval requests listed, across the 2 objects, Opportunity and Work Order. We have a link to the record, we can see the status and when it was submitted. One thing that is missing, is the user that the approval request is currently assigned to for approval. Back to the report builder, and after going through all of the available fields, unfortunately it is not available. So, we can list pending approval requests, but not with the user it is pending with. This maybe satisfactory, as we can drill down into each record and check the approver assignment, but in cases where we really need to see the pending approvers in the report, we need another solution.
After considering our options, we may decide that we will put the time into developing a Visualforce report, as we will be able to design it to include the fields we want, including the approver name. Fortunately, creating a simple list report, is not difficult. It just needs a query against the appropriate objects, and we are able to retrieve the approver name. Here is what our simple report looks like:
Pending Approvals Visualforce Report
To get this to work, you will need to create the APEX class first, then create the Visualforce page.
What Certification are you studying for now?
Focus on Force currently provides practice exams and study guides for ten certifications