You need to sign in to do that
Don't have an account?
Morton Hsiao
How do I put polypmorphic task fields in the predicate
Here's an easy example
select id, typeof what when opportunity then name end from task where opportunity.name = 'sql is better'
this doesnt' work. I can't use what like
where what.name = 'sql is better' because what is a special field so that I coudl do where what.type = 'Opportunity', but then I can't do what.?
select id, typeof what when opportunity then name end from task where opportunity.name = 'sql is better'
this doesnt' work. I can't use what like
where what.name = 'sql is better' because what is a special field so that I coudl do where what.type = 'Opportunity', but then I can't do what.?
In the WHERE clause you can only filter by the TYPE as you already found out.
So you cannot filter by what.name or any other field than the SObject type.
documentation link : https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_typeof.htm