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
keady@sfdckeady@sfdc 

Track InlineEditEntitySave on chatter

Hi,

 

I have a object in which few fields are enabled for feed tracking. whenever any changes on those fields, the follower is intimated and the same is posted on the chatter on the records detail page. My requirement is to copy these feeds and post it again on chatter groups. i could able to do this for direct chatter updates (i have written a trigger on feeditem to track this) but when any field changes, feeditem in not getting called. i supose this is not handled by feeditem.

 

Can someone please guide me how to track it programatically?

 

Thanks in advance!

Jia HuJia Hu
Feeditem Trigger will not fire for the FeedTrackedChange feed.

You can let the users to follow the records, and when the records are updated, the user can see the FeedTrackedChange feed on their Chatter pages,

or you can use Workflow to monitor the update of fields and send email to the users,...

keady@sfdckeady@sfdc

Hi Jia,

 

You are right, there feeds are displayed in users chatter home page. But my concern is i need to push these feeds to the chatter group. so that user who are interested in particular project then they can track all the changes by visiting that group instead of going to the home page and find the changes in all the feeds which they are subscribed.

Jia HuJia Hu
I got it.

For example, if you want to monitor the field changes on Account object.
Just create a Trigger on Account object, and post the update to a Chatter group in this Trigger.
keady@sfdckeady@sfdc

Yes, suppose there are 2 fields enabled for feed tracking in account object, then i need to write a trigger on account. Salesforce creates AccountFeed object to keep track of these changes and FeedTrackedChange object will have the old  and new values. I'm trying to read these values from FeedTrackedChage object by accessing its parent in this case it is AccountFeed.

 

sample code:

List<Account> projFeedList = [SELECT Id (SELECT OldValue, NewValue, FieldName FROMFeedTrackedChanges)From Account WHERE ParentId = Id AND Type = 'TrackedChange'orderby CreatedDate desc limit 1];

 

this query works absolutely fine but first time it will return the previous chnages if any, then if you execute the tripper again it will execute the new changes. i did not understand why it wil return old changes first time. there is some time delay in actually inserting these feeds to the chatter.

 

 

Jia HuJia Hu
Do not use FeedTrackedChange or AccountFeed,...

Use Trigger on Account to monitor the change of Account record directly,...