You need to sign in to do that
Don't have an account?
JTec
Relationship queries with Events and opportunities
Hi,
We are trying to develope a scontrol in wich we need to query for the Events creat in a determinate date and those will be relation with a opportunities that have a determinate LeadSource. The problem is when i use the e.What.LeadSource in the where clause the appi return this error:
"No such column 'LeadSource' on entity 'Name'"
This a example of the query of we try to run:
Select e.What.Type, e.What.Name, e.What.Id, e.WhatId
From Event e
where e.What.Name <> '' and e.What.Type = 'Opportunity' and e.What.LeadSource = 'Database'
limit 25
Can we do?
Thanks.
We are trying to develope a scontrol in wich we need to query for the Events creat in a determinate date and those will be relation with a opportunities that have a determinate LeadSource. The problem is when i use the e.What.LeadSource in the where clause the appi return this error:
"No such column 'LeadSource' on entity 'Name'"
This a example of the query of we try to run:
Select e.What.Type, e.What.Name, e.What.Id, e.WhatId
From Event e
where e.What.Name <> '' and e.What.Type = 'Opportunity' and e.What.LeadSource = 'Database'
limit 25
Can we do?
Thanks.
werewolf
No, you can't do that because WhatId is a polymorphic field. Because it can refer to many different objects, you can't use it like a regular relationship field. You'll have to do 2 queries, the first to find the events on Opportunity and the second to whittle down the set of opportunities from that list.
JTec
Thanks for reply werewolf.