+ Start a Discussion
Turk48Turk48 

Following contact's activity log

I want to implement the solution described in Knowledge Article Number: 000003788 in regard to notifying account owners of activities logged against their accounts, but I am not sure on how to do this. Can someone walk me through it? Thanks

AroraAnupAroraAnup

The solution is to be able to automatically add a Chatter feed of an Account, Contact, Opportunity, Case etc. every time a new Activity (Task or Event) is created, related to these objects. Feed gets posted using a Trigger on Task or Event, whichever you want to monitor

 

In your case, since you want to follow the Activity log of the Contact, you need to write the following trigger as detailed in the solution article:

 

trigger accountOwnerChatterUpdateOnTask on Task (after insert) {

//Get the list of accounts where a Task has been added 
List <FeedItem> chatterPostsToAdd = new List <FeedItem>() ;

        for(Task t : Trigger.new){
        
        //TODO: Change the text of the Body to something meaningful, such as the name of the person who created the task and the due date
        FeedItem accountPost = new FeedItem();
        accountPost.ParentID = t.accountId ;
        accountPost.Body = 'This is the text that appears in the Account Feed';
        chatterPostsToAdd.add(accountPost);
        
        }

insert chatterPostsToAdd;

}

 

Hope this helps!

Ashish_SFDCAshish_SFDC

The Article:
Is it possible to notify Account Owners of Activities logged against their accounts?
http://help.salesforce.com/apex/HTViewSolution?id=000003788&language=en_US