You need to sign in to do that
Don't have an account?
Prasanthsagar
Chatter - Auto Follow
I have an opportunity where a User lookup is created to it.
Now whenever an opporunity record is created which contains the User lookup too, the user selected in the record should get the chatter feed whenever some changes are done to the opportunity.
Is this possible using a trigger??? Or any sort of customization??
Pls suggest...
Id aid = [Select Id from Account Order By CreatedDate Desc limit 1].id;
EntitySubscription es = new EntitySubscription();
es.ParentId = aid;
es.SubscriberId = Userinfo.getUserId();
insert es;
Then current user will follow this new account now.
All Answers
2. select Opportunity fields to monitor, up to 20 fields
3. create a Trigger on Opportunity, when a Opportunity record is created, make the looked up user follow this recorder
4. then when this record is updated, in the lookup user's profile page, you will get a Feed Tracking chatter feed
Jia Hu, Thank u very much for the reply.
The trigger is fine. But could you please eloborate on 'how to make the user to follow this record!!'
Could you provide the code!!!???
Id aid = [Select Id from Account Order By CreatedDate Desc limit 1].id;
EntitySubscription es = new EntitySubscription();
es.ParentId = aid;
es.SubscriberId = Userinfo.getUserId();
insert es;
Then current user will follow this new account now.
Thank u once again Jia Hu,
I have executed the trigger and it is working splendid while inserting the record.
But when i try to update 'EntitySubscription' object, I am getting an error 'DML operation UPDATE not allowed on EntitySubscription' .
Update operation cant be done on EntitySubscription?
Also, I think there is a governor limit for the number of records a user can follow is 500. Is it correct???
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_entitysubscription.htm
use insert on EntitySubscription, but no update
I have tested in Apex, no problem. But you have to test it in trigger, may have some extra limits there.
Yes, people and records you can follow is 500
Hi ,
We have a Contract custom object with account as parent . If the contract end date is about 180 days , a chatter feed should be placed on account owner chatter page . Any help please.
Thanks in advance..
Force users to auto-follow Account, Project & Opportunity records that they own OR are on the team of - Can you suggest the ways?