• Pim Uijttewaal
  • NEWBIE
  • 10 Points
  • Member since 2013
  • Salesforce Architect EMEA region HOYA
  • HOYA Holdings N.V.

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi

I need a trigger on a chatter post, that once a chatter is posted on an account that a comment is inserted, mentioning the owner of this particular record.
I have in all honousty no idea where to start, any suggestions pls, as to code recipes etc? thx
Hi

I need a trigger on a chatter post, that once a chatter is posted on an account that a comment is inserted, mentioning the owner of this particular record.
I have in all honousty no idea where to start, any suggestions pls, as to code recipes etc? thx

Disclaimer: I'm a newbie at programming in Apex.

My company wants to use a Chatter group to allow employees and customers to submit and comment on new product ideas. I need to write a trigger so that when a new FeedItem is created on the New Ideas group in Chatter, it creates a new Idea record, linked to the FeedItem.

Does anyone have an example of creating a new Idea object each time a new Chatter post occurs?

This is what I have so far, and of course, I get an error just saying that Salesforce has been notified.


 trigger createNewIdeaTrigger on FeedItem (before insert) {
        for (FeedItem f: trigger.new)
        {
            Idea newIdea = new Idea(Categories = 'NewIdea', Status = 'New', Body = f.Body, CommunityId = '09a300000004gvG', Title = 'New Idea') ;
                f.parentId = newIdea.Id;
                newIdea.postID__c = f.Id;
               
                insert newIdea;
           
        }
    }