Reply
Contributor
HarrySie
Posts: 9
0
Accepted Solution

FeedItem.ID is null

Hello I've written a trigger to comment feeditems with special keywords. The problem is, that the feedItem.ID is null and so the insert comment fails. Why is the feeditem.ID null?

Trusted Contributor
Alex.Acosta
Posts: 213
0

Re: FeedItem.ID is null

If your trigger is set to before insert... you don't have an id yet. It needs to be inserted into the database first.

 

If you're just altering the data prior to insert you shouldn't need to do any DMLs on that particular record.

Thank you,
Alex Acosta
Contributor
HarrySie
Posts: 9
0

Re: FeedItem.ID is null

Hello Alex,

 

yes, that was a stupid question. I thought I implemented an after insert trigger, but in fact it was a before insert one.

 

Thanks

Harry


Alex.Acosta wrote:

If your trigger is set to before insert... you don't have an id yet. It needs to be inserted into the database first.

 

If you're just altering the data prior to insert you shouldn't need to do any DMLs on that particular record.


 

Trusted Contributor
Alex.Acosta
Posts: 213
0

Re: FeedItem.ID is null

There are no stupid questions Harry. I've made silly mistakes like this in the past, and hey, if it helps someone resolve a similar issue., then it makes the post worthy as well.

Thank you,
Alex Acosta