function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SunnyShinySunnyShiny 

What would be the query to export owner of contact linked to an event

Hi

first of all thanks for your help .. im new on soql and lost after sql server.

If there is any table showing difference between sql and soql Im interested

 

So I ve got a list of users and I need a list of event with the id of the contact assigned to and the owner of this contact.

I've got not clue how to do that in soql and I need to export this through data loader.

 

     SELECT Subject, OwnerId, Owner.Name, whoID, who.ownerID

     FROM Event

     WHERE ownerID in ('00Ua002500LIKza','00Ua002500jDKza','00Ua002500AaKzc')

 

Thanks a lot for your help

ReidCReidC

Looks like a job for Polymorphic SOQL Queries!! <soundEffects />

This works great on API 27.

You can test it by logging in to the workbench and selecting SOQL tools.

https://workbench.developerforce.com/

 

Select id, ownerid, TypeOf Who when contact then name, ownerId end From Event

 

Here's more info on Polymorphic queries.

http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm#relates_and_polymorph_keys

SunnyShinySunnyShiny

I've got this error >

MALFORMED_QUERY: SOQL TYPEOF expressions are not supported in this organization

 

Select id, ownerid, TypeOf Who when contact then name, ownerId end From Event

SunnyShinySunnyShiny

Is there an easy way to manage this without workbench through force.ide?

How can I make the relation ??? easily

 

is the fastest way by exporting event and contact and through excel doing a vlookup?

thanks