You need to sign in to do that
Don't have an account?
DSimpson
Newbie SELECT question
I;m trying to use SQL in a trigger, and it works as long as I don't use the WHERE clause. Can anyone tell me what I'm doing wrong? All I know is that it's not bringing back any records -- is it the syntax? I've checked the spelling of the fields.
Idea mainIdea = [SELECT Id, PostId__c from Idea WHERE PostId__c = :c.ParentId LIMIT 1];
PostId__c is a field I've added to Idea, and c is a FeedComment.
if the syntax was incorrect, your code wouldn't compile and you wouldnt be able to save it.
Hopefully the ParentId is not null i.e. you ought to have selected the ParentId in the FeedItem soql you may have be executing prior to this query
Above the query, put this:
Then use the Debug Logs to find out what the value is. Seems like it's something that doesn't match any Idea records.
Is this is resolved or you are still facing some issues?
I've tried the system debug line, and it seems that the parentId of the FeedComment isn't the FeedItem to which it's attached, but the Group ID (plus another three characters that aren't in the Group Id....hmmm). So I have to figure out how to identify the actual FeedItem that this comment is attached to.
The extra 3 characters aren't an issue:
http://www.blog.bdgreen.it/2011/01/09/salesforce-ids-and-the-15-18-digit-problem/