Quantcast
Channel: Active questions tagged chatter-feed - Salesforce Stack Exchange
Viewing all 191 articles
Browse latest View live

CallLogPost chatter Type

$
0
0

I have a scenario where when a task (of type Inbound Call) is updated, then a chatter feed of type "CallLogPost" should be created on the related Case.

Has anyone implemented this scenario so far?


create a feed stream

$
0
0

im kinda new to apex and sf i general.. i was recently tasked with fetching specific feeds that fulfill some criteria (1. addressed to context user [to Me feeds], 2. contain a mention of case object that are open).. quite alright, ive been able to retrieve these feeds using connect api methods....

but i need a way to display these retrieved feeds in a seperate window.. first idea was to make use of a vf page, but i cant see anything that helps me do that online...

and now another idea i have seen is to create a stream.. but how i do add those exact feed elements to the stream????? pls help me here.. thank you

 public class DisplayChatterController{


public DisplayChatterController(){
//  Connectapi.FeedElement newfeed;  not sure if this is necessary
}

public static void getFeeds(){
   list<Case> CaseIdlist = new list<Case>();
   CaseIdlist = [SELECT id,CaseNumber FROM Case WHERE Status = 'New' Or Status ='On Hold' or status= 'Escalated'] ;

   Connectapi.feedType fd = connectApi.feedtype.To;
   Connectapi.FeedElementPage fpp = Connectapi.ChatterFeeds.getFeedElementsfromFeed(null,fd,'me');
   Connectapi.FeedElementPage newfeedpage ;  
   Connectapi.feedelement n;
   Connectapi.FeedElement newfeed;
   list<ConnectApi.FeedElement> b = fpp.elements;//puts all feed elements in an array
   String feed;
   String comment;
   String identity;
   for(integer i =0; i<b.size();i++){
        boolean gotCaseInFeed = false;
        n = b[i]; //get the feedelement at index i
        Connectapi.CommentPage cp = Connectapi.ChatterFeeds.getCommentsForFeedElement(null, n.id);
        list<Connectapi.Comment> dComments = cp.items;//list of comments for feed n at index [i]
       /*logic
        1. loop thru the message segments and check if any instance of the message segments contain a reference to a case
        2. if none of them do, then fetch commentpage for the Feedelement and loop through 
        3. store all these feeds in some sort of container so that we can display them in a visualforce page
       */
       for (integer j =0; j<n.body.MessageSegments.size();j++){ 
            Connectapi.MessageSegment m = n.body.MessageSegments[j];//get message segments per feed     
            //condition 2.. when the feed messageSegment is an entitylink segment input
            if(m instanceof Connectapi.EntityLinkSegment){
                Connectapi.EntityLinkSegment ent = (Connectapi.EntityLinkSegment)m;
                identity = string.valueOf(ent.reference.id);//get the referenced Id
                for(Case cs: CaseIdlist){
                    if(identity == String.valueOf(cs.Id)){
                        system.debug('this feed has an entitylink with an Id of: ' + identity);
                        gotCaseInFeed = true;
                        //system.debug(n);
                        newfeed =n;//feed to be displayed
                       // newfeedpage.elements.add(newfeed);
                    }                                                                            
                }
            }
        }
            //comments should only be checked when the all of the feed items message segments does not contain the
            //reference to a case.. 
       if(gotCaseInFeed == false){
           for(integer k = 0; k < dcomments.size();k++){
               Connectapi.comment cm = dcomments[k]; //each comment in the comment array
               comment = cm.body.text;  
               for (case cs: CaseIdlist){       
                   if(comment.contains(String.valueOf(cs.CaseNumber)))
                       system.debug('this comment contains a string Value of a referenced case number: '+comment);
                        newfeed =n;//feed to be displayed
                  // newfeedpage.elements.add(newfeed);
               }
           }
       }
   }
    //  return newfeedpage.elements;
}
  }

thats my code guys.. i appreciate any form of useful advice on this thanks

Using a forceChatter:feed component to render activity

$
0
0

In the lightning component that I am making, I want to mimic the behaviour of the chatter feed views, All Updates, Call Logs, Text Posts and Status Changes. (In the screenshot below)

Basically I want to render them with their data in my own component.

For that I am using the component forceChatter:feed, and I am using it like -

<forceChatter:feed type="Record" />

I read the documentation, but I don't understand how to render feeds for different types as it comes in the screenshot. What should be the value of the type prop to render the feeds for All Updates, Call Logs, etc.

Any leads will help.

enter image description here

Create Custom Chatter Feed

$
0
0

I was recently tasked with retrieving chatter feeds addressed to the context User {'To Me' feeds} and only those ('To Me' feeds) that were on Cases (standard Objects) that were 'Open' and getting to display those feeds in a separate window... I have tried using vf pages and apex controllers.. but I had to write a lot of code and then I can't get the view to display a Connect API Object...

Is there a way I can make use of the Connect API create stream method to achieve this...so that all forms of functionality is still available for the retrieved posts?

Filter/Search Chatter from User X to Me?

$
0
0

Is there a way to list down (view) all chatter that is from a specific User (say X) to me?

Currently, I can only do "To Me" but can't sub-filter that list to show a specific User's post to me.

Bonus: If I can get this filtered list to further filter and only show ones which are pending replies from me, that will be great.

Coding/Apex Option (if any), please share details.

How to display chatterfeed shell in a visualforce page

$
0
0

I have a requirement to assign vf pages to the record type. Now I'm struggling with case detail page because i need to show chatterfeed shell button like standard page layout.

But if I use chatterfeed it's showing directly all updates & user not able to display show/hide button.

Standard view

enter image description here

In vf page enter image description here

How to achieve like in a standard way.I need guidance to setup this model

How to use customFilter in ConnectApi.ChatterFeeds.getFeedElementsFromFeed?

$
0
0

Does anyone know how to use custom Filter getFeedElementsFromFeed for case feeds in Salesforce?

I use getFeedElementsFromFeed(communityId, feedType, subjectId, recentCommentCount, density, pageParam, pageSize, sortParam, customFilter) but I'm struggling to define customFilter. Based on ConnectApi ChatterFeeds documentation it should be a string.

I need to get only feed items of types 'TextPost' or 'CreateRecordEvent'.

Hide Follow button in community

$
0
0

File Detail page in community display Follow button, follower, and file version.
We don't want to show this to portal users.
I checked Feed Tracking but I can't find how to hide follow button.
What should I do?
enter image description here


Quick Action does not appear to Feed Publisher of Case object in Community

$
0
0

I want to add Log A Call, Email and New Task to Feed Publisher of Case Object in Community.

In Support Settings I enabled:

  • Enable Case Feed Actions and Feed Items
  • Enable Community Case Feed
  • Enable Email Notifications for Case Posts

In Email to case I enabled:

  • Enable On-Demand Service

In Deliverability I was set field Access level equals All Email

I also dragged all actions to layout but they don't appear to Feed Publisher in Community.

My User License is Customer Community Plus.

I missed any something for show actions to Feed Publisher ?

How to move Chatter Feed of type 'TrackedChange' from contact to person account

$
0
0

We have recently adopted person account and are trying to move chatter feed from contacts to person accounts.

According to this article: https://help.salesforce.com/articleView?id=000213215&type=1 , we need to insert chatter feed in this case. However, feedItem with type 'TrackedChange' cannot be inserted via dataloader.

The type of FeedItem. Except for ContentPost, LinkPost, and TextPost, don’t create FeedItem types directly from the API.

So what is the normal way of handling this issue?

As requested, I post my sample anonymous block code in here:

FeedItem fi = new FeedItem();
fi.ParentId = '0016D00000AEjiRQAT';
fi.Type = 'TrackedChange';
fi.isRichText = false;

insert fi;

It still result in the same error message.

Send Direct Message from Enhanced Lightning Grid

$
0
0

Description

I am trying to create button in an Enhanced Lightning Grid that functions in the same fashion as the "New Message Button" component in Customer Communities.

My Sortable Data Grid Action is currently configured as such:

  • Event: e.forceChatterNewMessageButton.newMessageButton
  • Action Type: Row
  • Payload: {"entityApiName":"FeedPost","ParentId":"#ID#"} (The object the Sortable Data Grid references is the User object)

The error I am receiving when I click on the row button is as follows:

Error
Invalid event name - cannot identify event

Question:

What part of my Sortable Data Grid Action is incorrectly configured that is leading to my error message.

ConnectApi.NotFoundException: Resource not found

$
0
0

I am getting an error when using the ConnectApi to post a feed:

ConnectApi.NotFoundException: Resource not found. Class.ConnectApi.ChatterFeeds.getFeedElement: line 1502, column Class.ChatterPostParser: line 154, column 1 Class.RestComments.insertComment: line 66, column 1

I am trying this code:

List<User> mentionUsers = new List<User>();
ConnectApi.CommentInput feedCommentInput = 

ChatterPostParser.parseChatterCommentWithMentions(comment, mentionUsers);
ConnectApi.Comment commentRep = ConnectApi.ChatterFeeds.postCommentToFeedElement(
                                  Network.getNetworkId(),
                                  (Id)feedId,
                                  feedCommentInput,
                                  null);

Change FeedItemPost CreatedById using ConnectApi

$
0
0

I want to post chatter items via Apex with a link attached and an @ mention. I've been able to figure out how to attach the link and @ mention through research.

The next step to finishing this is to change the CreatedById of the post - Instead of it saying MyName to FriendName, I want it to say AnotherUser to FriendName.

Doing this using the FeedItem object is relatively easy since you can change the CreatedById value but I'm having trouble figuring out how I can do that with the ConnectApi.

Here is my code so far :

ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile;
ConnectApi.FeedItemInput feedItemInput = new ConnectApi.FeedItemInput();
feedItemInput.subjectId = 'Friends Id'

ConnectApi.MentionSegmentInput mentionSegmentInput = new ConnectApi.MentionSegmentInput();
ConnectApi.MessageBodyInput messageBodyInput = new ConnectApi.MessageBodyInput();
ConnectApi.TextSegmentInput textSegmentInput = new ConnectApi.TextSegmentInput();

messageBodyInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();

textSegmentInput.text = 'Congrats ';
messageBodyInput.messageSegments.add(textSegmentInput);
mentionSegmentInput.id = 'Friends Id';
messageBodyInput.messageSegments.add(mentionSegmentInput);

ConnectApi.LinkCapabilityInput linkInput = new ConnectApi.LinkCapabilityInput();
linkInput.url = 'www.helloworld.com';
linkInput.urlName = 'hello world';

ConnectApi.FeedElementCapabilitiesInput feedElementCapabilitiesInput = new ConnectApi.FeedElementCapabilitiesInput();
feedElementCapabilitiesInput.link = linkInput;

feedItemInput.capabilities = feedElementCapabilitiesInput;
feedItemInput.body = messageBodyInput;
ConnectApi.FeedElement feedElement = ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), feedItemInput);

Open to other approaches too

How can I make file public in Salesforce to fix a sharing error?

$
0
0

When I try to share a file in Salesforce, I get the error that

The maximum number of times this file can be shared has been exceeded

Which means it is shared > 100 times. The documentation indicates that

The maximum number of times a file can be shared is 100. This includes files shared with people, groups, and via links. If a file is privately shared and nears the 100 share maximum, consider making the file public by posting it to your feed.

But how do I do that? When post an existing file to my feed and then try to share it, it still throws the same error... How can I prevent this sharing error?

Note: the file was originally uploaded in a Library.

Set Default "From" address for email sent through Chatter Feed

$
0
0

I've created an Organization-Wide Address (Corporate CC) and I want this email to be the default "from" address when an operator send an email through the case Chatter Feed

enter image description here

as you see from the image, I can see "Corporate CC" in the "From" droplist, but the default is the email of the current User (User User). I tried, like someone suggested, to add the same address to the Feed View "Specify From Address(es)" configuration but still doesn't work.


Announcement is null when queried on feedItem Trigger

$
0
0

When i try to fetch announcements from feedItem trigger it returns null always, is there anything i'm missing

trigger Email_Feed_Trigger on FeedItem (after insert) {   
Set<Id> myfeed=new set<Id>();

for(FeedItem item : Trigger.New)
{
    myfeed.add(item.Id);
    }
    List<Announcement> lst=  [select id,SendEmails,FeedItemId,ParentId,createddate from Announcement where FeedItemId IN:myfeed];
   //lst is always blank
    system.debug(lst);
}

enter image description here

How do I create a FeedItem post with an @collaborationgroup

$
0
0

I've created a feed item post without issue but setting the @ in the body text does not work. How do I accomplish this

Happening on a case object

{
  FeedItem fi = new FeedItem();
  fi.parentid = c.id;
  fi.type = 'AdvancedTextPost'; // I've tried a few variations here
  fi.visibility = 'AllUsers';
  fi.body = '@Level-1-Updates Level 1 Case DETECTED for: ' + c.account.name;
  lfi.add(fi);          
}
insert lfi;

The problem is the feed item is plain text the collaboration group @Level-1-Updates is not getting notified or treated as a collaboration group. It's treating it as plain text

Remove Feed chatter in community

$
0
0

Does anyone knows how I can remove the chatter in community for user profile. I don't want that shows up. Please see the attachment, thanks.enter image description here

Like/Dislike chatter feed not working in Community

$
0
0

We need to give community user ability to like the feed item. Tried below code.

ConnectApi.ChatterFeeds.updateLikeForFeedElement(communityId,feedItemId, true);

Error:

System.NoAccessException: Insufficient Privileges: You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

This code is working with the standard user but not for the community user. Is there any setting for this?

Chatter FeedItem LinkUrl open in current tab

$
0
0

I have a Chatter Feed displayed in a Customer Portal, and I have Chatter Posts with a LinkUrl value.

Is it possible to change the way the anchor tags are rendered so they do not open a new browser tab target="_blank"

Chatter FeedItem with LinkUrl in Lightning

Viewing all 191 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>