I have an approval process which approves records based on some criteria in opportunity object. So I designed a visualforce component having a controller and I called the component in visualforce email template. I just want to know how to get the approver name in the component so that it will be displayed in the initial submission of approval process. Any help will be appreciated.
The code looks like this:
The controller code
public class oppor_recs
{
public List opList{get;set;}
public List getOpportunity()
{
opList=[SELECT Name,StageName,Amount,CloseDate
FROM opportunity
WHERE Amount > 50000 AND CreatedDate=:Date.Today()
LIMIT 10000];
return opList;
}
}
visualforce component
<apex:column value="{!opp.name}">
<apex:facet name="header">Name</apex:facet>
</apex:column>
Best Answer
I think you might be wanting to use the
ProcessInstance
object in your code. It has a child relationship to Opportunity, which should enable to you get the approver name.In your query, you could try something like this:
You may want to do some post processing before rendering to the page, but I think this will work for you.