You need to sign in to do that
Don't have an account?
A Simple Chatter Trigger
Hi All. Below is a really simple chatter trigger that I have written to help me with creating cases from chatter posts. It's my first chatter trigger, and I'm getting stumped on the line that is commented out. I can't get that line to compile. It seems that I can't get the FeedItem's Body from the feedcomment. Is my syntax wrong, or is not possible this way?
Thanks!
trigger createCaseFromChatter on FeedComment (after insert) { for(FeedComment f : trigger.new) { if(f.CommentBody.startsWith('!newCase')) { Case newCase = new Case( Subject = f.CommentBody, //Description = f.FeedItem.Body, Origin = 'Chatter', RecordtypeId = '012G0000000yArc', Status = 'Open' ); insert newCase; } } }
try this.
All Answers
try this.
That works. Kind of a bummer that the soql query is necessary...but then again I had dml inside the for loop!
Thanks!