You need to sign in to do that
Don't have an account?
Contact Activity History
I have created this visual force page with an APEX controller. However, how can I get the edit link under "Action" next to each record? This is the same "edit" link under activity history on left side of each record. What visual force tag would do this?
Also how can i also put the link that says if there are a certain amount of record under mycustom task history vf page?
<apex:page standardController="contact" extensions="TaskController">
<apex:pageBlock title="Task History" >
<apex:pageBlockTable value="{!Tasks}" var="t">
<apex:column value="{!t.activitydate}" />
<apex:column value="{!t.subject}"/>
<apex:column value="{!t.whoid}"/>
<apex:column value="{!t.whatid}"/>
<apex:column value="{!t.type}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
public class TaskController {
private final Contact cont;
public TaskController(ApexPages.StandardController controller) {
this.cont = (Contact)controller.getRecord();
}
Public Task[] getTasks(){
return [Select id, subject, what.id, who.id, type, activitydate from Task
where whoid=:cont.id ];
}
}
For the first, you'd need to add a column titled 'Action' and output a CommandLink that takes you to the edit page for the record you are iterating.
For the latter, you'd need to construct these links yourself and add them to the page beneath your table.
do you mean you want to have an Edit link on the left side of each record that takes the user to the edit page when he clicks on it?
if thats the case then you can use the <apex:outputLink> tag...
<apexage standardController="contact" extensions="TaskController">
<apexageBlock title="Task History" >
<apexageBlockTable value="{!Tasks}" var="t">
<apex:column headerValue="Action">
<apex:outputLink value="/{!t.Id}/e?retURL=/apex/{!$CurrentPage.Name}"><b>Edit</b></apex:outputLink>
</apex:column>
<apex:column value="{!t.activitydate}" />
<apex:column value="{!t.subject}"/>
<apex:column value="{!t.whoid}"/>
<apex:column value="{!t.whatid}"/>
<apex:column value="{!t.type}"/>
</apexageBlockTable>
</apexageBlock>
</apexage>
I hope this helps..
Thanks. 2 things
1. The header value Action label appeared but not the edit link next to the record..it's just white space
2. How do i only show a maximum of 5 records on this vf page and if I want to see more there are these links at the bottom left of the page. I thought these links would be the easier part for me after I got the MVC created but guess not..=)
<apex:page standardController="contact" extensions="TaskController">
<apex:pageBlock title="Task History" >
<apex:pageBlockTable value="{!Tasks}" var="t">
<apex:column headerValue="Action"/>
<apex:outputLink >"/{!t.Id}/e?retURL=/apex/{!$CurrentPage.Name}"><b>Edit</b></apex:outputLink><apex:column />
<apex:column value="{!t.activitydate}" />
<apex:column value="{!t.subject}"/>
<apex:column value="{!t.whoid}"/>
<apex:column value="{!t.whatid}"/>
<apex:column value="{!t.type}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
you are closing the column tag and then writing the outputlink..also in outputlink you are not giving the url in value attribute...
this is what you have done :
<apex:column headerValue = "Action" />
<apex:outputLink>"/{!t.Id}/e?retURL=/apex/{!$CurrentPage.Name}"><b>Edit</b></apex:outputLink>
instead you need to do this
<apex:column headerValue="Action">
<apex:outputLink value="/{!t.Id}/e?retURL=/apex/{!$CurrentPage.Name}"><b>Edit</b></apex:outputLink>
</apex:column>
This worked! but there are few more issue
1. How can I get these links at the bottom of the page. I can change my query to limit 5
Show more » | Go to list »