+ Start a Discussion

relationship Event to Account


Why I cannot link Event to Account in relationship query, such as: Event.Account.Name ?

You need to do it like
Event.WhatId = Account.Id
If this answer you question then mark it as solution.
wow, after more than 6 years someone reply :)
but that is not the answer, I was asking for soql query, not in apex code
I think should be this
Select e.AccountId, e.Account.Name from Event e

I think your query will do half job! It should be
SELECT e.WhatId, e.AccountId FROM Event e
as Account Id can be any of the WhatId/AccountId on event record. If you want to do more manupulations then you need to get those WhatIds and AccountIds in a Set<Id> and fetch Accounts for those Ids to do further manupulations.