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
BrandiTBrandiT 

Possible to add a "Items to Approve" component/widget to Sidebar??

My VP does not like the current process he uses to approve contracts and other objects.  He uses the "Items to Approve" component on the home page, but for each item, he clicks to go view the actual record with all the details.  Then he approves or denies, then has to click the home tab again to see the next item in his list.

 

I would like to add a similiar widget to the sidebar instead so that he doesn't have to click the home tab every time to see his list.

 

Has anyone done anything like this already?  I'm sure it's possible, but have no idea how to do it.

 

It doesn't have to look exactly like the current component, all I need is a list to show up on the sidebar.

 

Thanks!

sfdcfoxsfdcfox

Possible? Certainly. It's a matter of if anyone's done it, and if so, if it's available. You'd want a VF page which would be embedded on the sidebar using an iframe/custom HTML sidebar component. It shouldn't take more than 60 minutes to write up something like this, but I don't have that kind of time to spare at the moment.

BrandiTBrandiT

Ok new idea:

 

I want to create a whole new tab with a list of items to approve like on the home page.  When an item is clicked, it rerenders in an output panel below the list.

 

Very much like this example:  http://www.salesforce.com/docs/developer/cookbook/Content/vf_ajax.htm

 

Problem:  The example in the about link used contacts so the output panel code went like this:

 

<apex:outputPanel  id="detail">
    <apex:detail subject="{!contact}" title="false"
                relatedList="false"/>

Since I'm doing items to approve, the records could be contracts, leads, or custom objects.  How to I code the subject portion of the above code to account for any of these objects.  I thought I would have to insert something in my controller to get the object, but not sure how to do it.

 

What do you think?

sfdcfoxsfdcfox

You probably want something like this:

 

 

<apex:page controller="approval_controller">
	<apex:form>
		<apex:pageBlock title="Items To Approve">
			<apex:pageBlockTable value="{!items_to_approve}" var="item_to_approve">
				<apex:column headerValue="Items To Approve">
					<apex:outputLink target="_top" value="/{!item_to_approve.id}">{!item_to_approve.name}"/>
				</apex:column>
			</apex:pageBlockTable>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

public class approval_controller {
	public class item_wrapper {
		public item_wrapper(id id,string name) {
			this.id = id;
			this.name = name;
		}
		public id id { get; set; }
		public string name { get; set; }
	}
	
	public list<item_wrapper> items_to_approve { get; set; }
	
	public approval_controller() {
		items_to_approve = new list<item_wrapper>();
		for(ProcessInstanceWorkItem item:[select processinstance.targetobjectid,processinstance.targetobject.name from processinstanceworkitem where actorid = :userinfo.getuserid()]) {
			items_to_approve.add(new item_wrapper(item.processinstance.targetobjectid,item.processinstance.targetobject.name));
		}
	}
}

I'm not intimately familiar with this particular entity, but according to the docs, it looks like it should more or less work.

 

 

 

The_London_ScottThe_London_Scott

Another approach that might work for some use-cases is simply to open the Items to Approve list's URL

 

/04i

 

in a component where you want it.

RadmhyaRadmhya
Hi Sfdcfox, 

Thanks for your code. I'm trying to create a new VF component with your code, but I'm unable to get the "Most Recent Approver" and "Date SUbmitted" values on to the new component. Also, I need to show some custom field information on to the items to approve component. Could you please guide me through this. 

Thanks!
Wenkatesh ReddyWenkatesh Reddy
Hi Radmhya,
I am also faced with similar issue. Were you able to get the solution?
 
LudivineLudivine
Hi,

I would be interested as well in adding some other fields to the custom component , can you please help me to display with that code the field Stagename and Account name from opportunity object?

many thanks.
Ludivine