1

One of the code recipes for Chatter allows/suggests you can monitor User status changes via a trigger (Recipe 12 shown here). The field "CurrentStatus" on User was deprecated in API v25 however and the FeedItem triggers do not fire on User Status updates. No problem, lets use API v24 for this code and it will work okay? It seems not.

I have created a trigger using the code from the sample and set the API to v24. I turn the debug logs on for the User and update the status to a new string but my trigger does not fire.

Any suggestions/ideas on resolving this? It seems odd that Salesforce have left the code up if they have deprecated said functionality completely for all API versions.

Thanks.

1 Answer 1

0

Are you sure about the feeditem triggers not firing off status updates. In a dev org I just tried the very simple example

trigger testTrigger on FeedItem (after Insert) {
    system.debug('Fired Due to Status Update');
}

I then updated my status

enter image description here

Then found this in the debug logs

06:06:22.252 (252289000)|EXECUTION_STARTED 06:06:22.252 (252322000)|CODE_UNIT_STARTED|[EXTERNAL]|01qi0000000S57a|testTrigger on FeedItem trigger event AfterInsert for [0D5i000000J37xC] 06:06:22.253 (253305000)|SYSTEM_METHOD_ENTRY|[2]|System.debug(ANY) 06:06:22.253 (253337000)|USER_DEBUG|[2]|DEBUG|Fired Due to Status Update 06:06:22.253 (253346000)|SYSTEM_METHOD_EXIT|[2]|System.debug(ANY)

It seems that all you need to do is create a trigger on the FeedItem object and you should be all set

2
  • So it seems (contrary to the documentation in recipe 11 on the linked page above) that FeedItem is updated via a trigger on change of a user's status. For the information of those who care - the post is not of Type "UserStatus" anymore but is of type "TextPost" which is where the documentation needs updating. Thanks for the spot - I had tested this but was filtering on those that were of the wrong type - UserStatus - which was why nothing was being selected in my trigger for the code to run on.
    – pbattisson
    Commented Nov 29, 2013 at 14:31
  • Thats actually good to know. I just assumed it was still "UserStatus". I!t would be good to have this more clearly documented. I would be curious if the new chatter cheatshhets from Dreamforce have this documented. Commented Nov 29, 2013 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .