You need to sign in to do that
Don't have an account?
VPrakash
Chatter Trigger to update the parent record feed with the child record feed?
Hi all,
I have a requirement where i need to insert the chatter feed on the parent(account) whenever a new chatter feed is inserted in the child(contact or opportunity) record.
Can this be done using the chatter Triggers? If so can you provide me the start point?
Thanks in advance
VPrakash
Yes definitely.
Create a trigger on FeedItem, filter it to execute only on Contact, then retrieve the Account id from the Contact and create a new FeedItem with the parentid = accountid.
Just make sure you filter to only execute on contact, otherwise you will get a recursive loop
HI Quinton,
I tried exactly what you described here but there is no parent chatter feed insert when there is child chatter feed insert. Please look into the following trigger and let me know where I am going wrong.
Parent(Agreement__c)
Child(Agreement_Line_Item__c)
trigger updateAgreementFeed on FeedItem (after insert) {
Thanks in advance
VPrakash
Looking at your code, the logic looks right, although I don't know if cloning a feeditem and related tracked changes as these will reference the original parentid. Your code updates the feeditem.parentid, but not the tracked changes which may cause issues.
So should I even update the new feedtrack changes on the new feed item with the old feedtrack changes. You think this would work? Or PLease can you give me suggestions on this issue.
Thank you
VPrakash
Logically it probably doesn't make sense as a tracked change would reflect a change on your child object, not your parent. Start simple, and build up from there.
Also, top of my head, I don't think a feed track change will fire a trigger on FeedItem as they are different objects in the schema.