• MarkOCT
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1
 I can not seem to get my chatter feed to refresh upon a post being inserted from apex code. I have created a global action that is a visualforce page. I add this to the Global Publisher Layout. Then in chatter I enter some info into the page I built, I format it in my controller and post it to chatter. Everything works as it should, except the feed doesn't update until I manually refresh the page. Does anyone know a way to make an action used in chatter refresh the chatter feed, or whole page?
//called from visualforce page
public PageReference insertIntoFeed() {
   ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
   input.subjectId = 'me';
   input.feedElementType = ConnectApi.FeedElementType.FeedItem;
   ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
   messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();

   addElement('Field One','line one',messageInput);
   addElement('Field Two','line two',messageInput);

   input.body = messageInput;
   ConnectApi.ChatterFeeds.postFeedElement(null, input);

   return null;

private void addElement(String header, String item,ConnectApi.MessageBodyInput messageInput){
    //add a blank line

private void addListItem(String item,ConnectApi.MessageBodyInput messageInput,Boolean isHeader){
    ConnectApi.MarkupBeginSegmentInput markupBeginSegment = new ConnectApi.MarkupBeginSegmentInput();
    markupBeginSegment.markupType = isHeader? ConnectApi.MarkupType.Bold : ConnectApi.MarkupType.Paragraph;

    ConnectApi.TextSegmentInput textSegment = new ConnectApi.TextSegmentInput();
    textSegment.text = item;

    ConnectApi.MarkupEndSegmentInput markupEndSegment = new ConnectApi.MarkupEndSegmentInput();
    markupEndSegment.markupType = isHeader? ConnectApi.MarkupType.Bold : ConnectApi.MarkupType.Paragraph;

I'm stuck on the Modify the NewURLPolicyCondition Apex Class challenge: Modify the NewURLPolicyCondition Apex class you created in an earlier challenge and change its condition from any time in the past two days to the past week.

I completed the previous challenges in this section with ease but don't see any reference to "in the past two days" so I am not sure how to modify the condition "to the past week". 

Please help!