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
kpr1kpr1 

Relation between approval process and user

When a user logs in, in his home tab, 'Items to be Approved' contains all the records that need approval from this user. Where is this information stored?I looked in user and Approval objects and didn't seem to find any field that stores the relation---this user has these records to be approved

 

The use case is this:

 

I have an approval on opportunity, where in the manager has to approve the salesprice of opportunity line items.

 

When the manager logs in, I provide a custom button from the opportunity detail page, which opens up a visualforce page from where he can see only those products that need approval. He then approves or rejects the pricing using this page. After that he has to come to the home page and click the link for the opportunity record under 'Items to be Approved' and click Approve or Reject button.

 

This works fine if he has only one record to be approved. But if there are multiple opportunity records to be approved, the manager would have a hard time going back and forth between the opportunity detail pages and the home page.

 

So I was trying to access the approval process from the visualforce controller itself, so that I could write code to Approve/Reject the request from teh visualforce page itself, instead of coming back to the home page. To do that, I need to access the approval requests associated with a user.

 

 

Can anyone help me this please?

 

Thanks in advance,

kpr

Best Answer chosen by Admin (Salesforce Developers) 
ron_reedron_reed

Oddly enough we have just finished creating an approval dashboard to help submitters and approvers manage their outstanding approvals.  There are three tables in the api that are important

 

ProcessInstance - represents the approval

ProcessInstanceStep - history of each of the individual approval steps

ProcessWorkItem - steps that are currently active in the queue.

 

We decided to show a list of all of the approvals up top and when a user clicks on a link next to the name, it opens up a separate window down below with the approval history table.  The user could then approve or reject right from that screen.  

 

Hope that helps.

All Answers

ron_reedron_reed

Oddly enough we have just finished creating an approval dashboard to help submitters and approvers manage their outstanding approvals.  There are three tables in the api that are important

 

ProcessInstance - represents the approval

ProcessInstanceStep - history of each of the individual approval steps

ProcessWorkItem - steps that are currently active in the queue.

 

We decided to show a list of all of the approvals up top and when a user clicks on a link next to the name, it opens up a separate window down below with the approval history table.  The user could then approve or reject right from that screen.  

 

Hope that helps.

This was selected as the best answer
kpr1kpr1
Thanks Ron for pointing in the right direction. I was able to use the tables to solve my problem!
PrasadVRPrasadVR

Hi Ron_reed,

 

         I am trying to do Same thing , But I am unable to complete it., Can You Help me out on this.