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

Test method fails to get FeedItem of Type TrackChanged

Hi ,


I have test method where i try to get the Feeditem of type trackedChange which is automatically created when we update a field value that is being tracked via feedTracking. But the test method is not able to get that feedItem record. Even tried with lowering the version, but no results. Can someone help?

Following is the testmethod: -

static testmethod void mytest(){
        Account acc = new Account(Name = 'TestAccountBhushan',Phone = '040-754-7845');
        insert acc;        
        acc.Phone = '040-123-4567';            
        update acc;      
        List<FeedItem > txtFeedItem = [SELECT Id,
               ParentId FROM FeedItem Where ParentId=: acc.Id];
               System.assertEquals(1, txtFeedItem.size());