+ Start a Discussion
sfdc@isha.ax1814sfdc@isha.ax1814 

how to display the time with the message of latest post in chatter in vfpage?

Hi,

 

how to display  the time and message  of latest post  in chatter in  vfpage?can anybody help on this ?

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
wt35wt35

One example:

 

Controller:

 

public class LastChatterPost{

public String lcpBody { get; set; }
public DateTime lcpLastModifiedDate  { get; set; }

public LastChatterPost(){

FeedItem lcp = [SELECT Body,LastModifiedDate FROM FeedItem ORDER BY LastModifiedDate DESC LIMIT 1];

lcpBody = lcp.Body;
lcpLastModifiedDate = lcp.LastModifiedDate  ;
}


}

 

Page:

 

<apex:page controller="LastChatterPost">

  <apex:outputText>{!lcpLastModifiedDate}</apex:outputText>
  <apex:outputText>{!lcpBody }</apex:outputText>
  
</apex:page>

 

You might want to amend the SOQL query as it searches across all Chatter Posts, ie. filter on today's date

All Answers

wt35wt35

One example:

 

Controller:

 

public class LastChatterPost{

public String lcpBody { get; set; }
public DateTime lcpLastModifiedDate  { get; set; }

public LastChatterPost(){

FeedItem lcp = [SELECT Body,LastModifiedDate FROM FeedItem ORDER BY LastModifiedDate DESC LIMIT 1];

lcpBody = lcp.Body;
lcpLastModifiedDate = lcp.LastModifiedDate  ;
}


}

 

Page:

 

<apex:page controller="LastChatterPost">

  <apex:outputText>{!lcpLastModifiedDate}</apex:outputText>
  <apex:outputText>{!lcpBody }</apex:outputText>
  
</apex:page>

 

You might want to amend the SOQL query as it searches across all Chatter Posts, ie. filter on today's date

This was selected as the best answer
sfdc@isha.ax1814sfdc@isha.ax1814

hi 

 

Thanku for answered the qn