function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eraloeralo 

Why does Chatter format messages as "<user A> to <user B> <Message>"

We're creating a Chatter feed using our App by putting a trigger on an object but in some cases the feed is formatted as "<user A> to <user B>: <Message>" instead of just "user B>: <Message>.

User B is the owner of the object and we're posting the message into their Chatter feed.

User A is the authenticated user (through the API) that caused the trigger to execute.

 

Is there any way to avoid this?

Jon Mountjoy_Jon Mountjoy_

Hi eralo

 

Looking at the Introduction to Chatter article, I think what's happening is that User A is creating a FeedComment.  What code are you using to update the status?  Can you show it?  

 

Jon

rwoollenrwoollen

Can you show me the code (or a snippet) from your trigger?  Are you changing a field which is being tracked for changes or are you inserting a FeedPost record?

 

Typically a FeedPost would be a message from 1 user to another (or to a record) hence the from / to syntax.

 

Depending on what you're doing in the trigger, you might prefer updating a field which is being tracked.  It might be helpful to hear more about what you're implementing.

infoweldernickinfoweldernick

Here is the code that is creating the FeedPost.  The record creating the trigger action is created via the api by a user <user B> that could be different than the ParentId <user A> we are using, but we are not referencing the created user <user B> anywhere in the code.

 

            FeedPost fp2 = new FeedPost();    
            fp2.Type = 'LinkPost';
            fpBody = '"' + aName + '" xxxxxxxxx ';        
            fp2.Body = fpBody;
            fp2.ParentId = lstESDSAE[i].Agreement__r.OwnerId;
            fp2.Title = 'View agreement ...';
            fp2.LinkURL = lstESDSAE[i].ServerUrl__c + 'salesforce.com/' + lstESDSAE[i].Agreement__c;
            lstFeedPost.add(fp2);