You need to sign in to do that
Don't have an account?
Swayamprava
Delete chatter post automatically with keyword 'Created' or 'updated'.
Hi,
Can any body help me on this. I want to delete the chatterposts automatically with keyword 'Created' or 'Updated'. This should be a trigger on chatter feed or anything else?
I have tried on Chatter teed Trigger::: But this is not working . When i created any new record the Chatter post "The Owner has created the Record." chatter post is still there.
My code---
Trigger delete_Records_with_Created on FeedItem (after insert) {
Feeditem thisf;
for(FeedItem f:Trigger.new){
thisf=f;
}
String body_text=thisf.body;
if(body_text.contains('created')==true)
delete thisf;
}
A suggestion. Would it be ok if you don't allow the feeditems to be created? I mean instead of after insert trigger deleting those records, just skip such records in a before insert trigger.
Yes it is ok for me. If you have the solution Please forward to me.
If it is before insert trigger then how to prevent the record to be inserted.
Just addError to records which you don't want to be inserted. Check this:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_exceptions.htm
If i will add an Error to the record then this wil dispaly me the error message. My requirement is not to insert those records. Not to display any Error message and control from there.