You need to sign in to do that
Don't have an account?
Nathan Prats
Queries : How to get Who.Title from Events
Hello,
I am desperately trying to get the Contact Titles from Events.
I couldn't create an activity custom field to get the Who.Title value.
I couldn't write a query with Who.Title so i'm trying to filter a contact query.
However, the below doesn't work. What am I doing wrong ?
SELECT Id, Title, (SELECT CreatedDate, WhatId , WhoId FROM Events WHERE CreatedDate = TODAY AND Meeting__c = TRUE)
FROM Contact
WHERE Id IN (SELECT WhoId FROM Event WHERE CreatedDate = TODAY AND Meeting__c = TRUE)
Any help is more than welcome,
Nathan,
I am desperately trying to get the Contact Titles from Events.
I couldn't create an activity custom field to get the Who.Title value.
I couldn't write a query with Who.Title so i'm trying to filter a contact query.
However, the below doesn't work. What am I doing wrong ?
SELECT Id, Title, (SELECT CreatedDate, WhatId , WhoId FROM Events WHERE CreatedDate = TODAY AND Meeting__c = TRUE)
FROM Contact
WHERE Id IN (SELECT WhoId FROM Event WHERE CreatedDate = TODAY AND Meeting__c = TRUE)
Any help is more than welcome,
Nathan,
It seems that we cannot access Title, Email or Phone fields on Task.Who or Event.Who. Reference for this : https://developer.salesforce.com/forums/?id=906F00000008wPeIAI
Because the WhoId and WhatId fields of Task/Event are polymorphic (i.e. can point to many different kinds of objects) you can't just query relationships through them like you can for normally-related objects. Instead, you'll have to store whoId and then perform query on Contact based on that whoId.
Sample code: Let me know if it works.
Thanks,
Dhanya
It sounds like a good idea.
Unfortunately, I won't use this query inside a trigger but in Force.com Explorer to fill an Excel Spreadsheet.
If you just want to see the details to fill an Excel Spreadsheet then you can create report of type 'Tasks and Events' and drag the details which you want.