4

I would like to have any users added to an Account's Account Team follow that Account in Chatter.

Similarly, I would like that user to unfollow the Account if they are removed from the Account Team.

I tried setting up triggers on the AccountTeamMember, but triggers can't be written for the AccountTeamMember object.

I thought about writing a Schedulable class that routinely looks at newly created AccountTeamMember rows and adds EntitySubscription records, but this only works for following.

For Unfollowing I'd have to go over the whole AccountTeamMember & EntitySubscription tables to see if there were any mismatches and remove them from the EntitySubscription table.

Is there another way to accomplish this?

1 Answer 1

3
+50

You are absolutely correct trigger can not be written on AccountTeamMember Object and also writing a batch class is not a very good option. I have faced the similar issue, there is a work around by which you can achieve this.please find the steps below : -

  1. Create one custom Object Name as "Account_Team_Member__c" with four fields,those are "Account","User","TeamMemberRole" and "Access".

  2. expose this object rather than the standard one.

  3. write trigger on the custom object,

  4. while adding team member first insert the record in standard object ,then follow the record and while removing, un-follow the record.

this way you can achieve this functionality.

You must log in to answer this question.

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