+ Start a Discussion

How to get all the columns from polymorphic Soql!

Hi All,

I have goen through the doc on polymorphic Soql and it says that what ever I write in after typeof fieldlist will be returnded but when I use this :


[Select Id, Description, ActivityDate, TYPEOF Who
WHEN Lead THEN Email WHEN Contact THEN Email END from Task]


It only retrun the Id, Description, ActivityDate columns and not the Email one??


I have refered this post : http://blogs.developerforce.com/tech-pubs/2012/09/soql-polymorphism-or-how-i-learned-to-love-the-polymorphic-relationship.html


Note: I have SOQL Polymophism enabled.


You should able to get the Email column as well. The query is correct, Whats the problem coming?


If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.