+ Start a Discussion
jgrenfelljgrenfell 

Using FolderId in the Where clause of an EmailTemplate Query

I'm creating a page that includes a list of Folders for email templates, and when the user selects a folder, I want to display the EmailTemplates in that folder.  I'm getting an error on the SoQL to do that though- "unexpected token : FolderId". The same query works fine in the Schema Explorer in Eclipse. 

 

 

List<EmailTemplate> ets = [Select Id, Name From EmailTemplate where FolderId := this.eFolder];

 

 Anyone have any ideas?

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

I think you fudged the binding, it should be

 

List<EmailTemplate> ets = [Select Id, Name From EmailTemplate where FolderId = :this.eFolder]; 

All Answers

SuperfellSuperfell

I think you fudged the binding, it should be

 

List<EmailTemplate> ets = [Select Id, Name From EmailTemplate where FolderId = :this.eFolder]; 

This was selected as the best answer
TehNrdTehNrd
Semi colon is in the wrong spot:

List<EmailTemplate> ets = [Select Id, Name From EmailTemplate where FolderId = :this.eFolder];

Edit: Too slow again. SimonF got it.

Message Edited by TehNrd on 02-26-2009 08:30 AM
jgrenfelljgrenfell
Oy, I'm going to blame that one on my cold, thanks!