You need to sign in to do that
Don't have an account?
Mandeep Deka
How to display Created Date/Last Modified Date along with Owner name as an outputfield?
What I am trying to achieve is shown in the below screenshot.
URL: http://imageshack.us/photo/my-images/10/viewdate.jpg/
what I have written is :
<apex:pageBlockSectionItem > <apex:outputLabel value="Created By" for="created__by"/> <apex:outputLabel value="{!createdby}" id="created__by"/> </apex:pageBlockSectionItem>
and the extension has a createdby property which only fetches the FirstName, LastName and CreatedDate and merges them together.
But then again the look up on the CompanyName on mouse hovering is not rendered on doing this.
Can anyone give some ideas on this?
Anyone up for this? Need some input to get me going...please, getting some insight would be really helpful.
Thanks.
Hi,
Just try this:
Class Code: accountClass.cls
public Account account {get;set;}
Page Code: accountPage.page
<apex:page controller="accountClass">
<apex:pageBlockSection title="Account Details">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Account Owner"/>
<apex:outputText value="{!account.Owner.Name}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Last Modified Date"/>
<apex:outputText value="{!account.LastModifiedDate}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Created Date"/>
<apex:outputText value="{!account.CreatedDate}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:page>
Url: https://c.ap1.visual.force.com/apex/accountPage?id='00000000000000'
Hi Rehan,
I appreciate your reponse. Sorry but this is the same thing what I did if you look at my query. I want to display the Owner name along with the Created Date and still want to retain the look up on mouse hover on the Owner name. Your solution does not solve that.
Thanks for the reply though.
Can u post your whole code so that i can have a look on it, what you have done.
Here it is:
View.page
and the extension Cost.cls is:
That's all I have done!
Check this code :
Page Code:-
<apex:page standardController="Contact" extensions="helloWorld">
<apex:pageBlock title="Hello{!$User.FirstName}" mode="edit">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Created By" for="created__by"/>
<apex:outputLabel value="{!createdby}" id="created__by"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputField value="{!Contact.AccountId}" />
<apex:outputText value="{!Contact.CreatedDate}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Class Code:
public with sharing class helloWorld
{
public String createdby {get;set;}
public helloWorld(ApexPages.StandardController controller)
{
Contact costObj = (Contact)controller.getRecord();
Contact costObj2 = [Select CreatedById,CreatedBy.FirstName,CreatedBy.LastName,CreatedDate from Contact where id=:costObj.id];
createdby = costObj2.CreatedBy.FirstName + ' ' + costObj2.CreatedBy.LastName +', '+costObj2.CreatedDate.format('M/d/yyyy hh:mm a');
}
}
I hope you had get your answer, just implement .
i have tryout with this code and it works.
Thanks.
This is the code you want if you need styling and links very close to VF page.