You need to sign in to do that
Don't have an account?
moverdorf
How To Query To Get Results Shown In Open Activities form?
Does anyone know what the SOQL query would look like to create the results shown in the Open Activities section of the Salesforce inteface?
I have tried to replicate it, but don't know how to get a list of Open Acivities for a contact, if the Open Activity doesn't belong directly to the Contact's Account.
For example, for my case, in the Open Activities section I see:
Subject Name Related To
AAA John Smith John Smith
BBB John Smith John Smith
CCC John Smith CM-137 (Client Meeting)
In my SOQL I can't get the CCC John Smith CM-137 row to be returned in my query, because the Task is NOT related to my Contact John Smith.
I have no idea how SF is doing this, can anyone help with a SOQL query or some code that would accomplish this? Thanks
For example, if a task's what.id is NOT for the contact but for something else, like a Client Meeting, I still want this task to be inlcuded in my query for the
I have tried to replicate it, but don't know how to get a list of Open Acivities for a contact, if the Open Activity doesn't belong directly to the Contact's Account.
For example, for my case, in the Open Activities section I see:
Subject Name Related To
AAA John Smith John Smith
BBB John Smith John Smith
CCC John Smith CM-137 (Client Meeting)
In my SOQL I can't get the CCC John Smith CM-137 row to be returned in my query, because the Task is NOT related to my Contact John Smith.
I have no idea how SF is doing this, can anyone help with a SOQL query or some code that would accomplish this? Thanks
For example, if a task's what.id is NOT for the contact but for something else, like a Client Meeting, I still want this task to be inlcuded in my query for the
So, the SOQL may look something like this:
Select Subject, Who.Name, What.Name from task where who.Name = 'John Smith'
This one is without any controller and soql. If you need to implement using soql, here is it,
--Akram
SELECT (SELECT Subject, WhoId, IsTask, ActivityDate, Status, Priority, OwnerId FROM OpenActivities) FROM Account
The problem with this, is that it will only bring back Open Activities that belong to the related Account. My Issue is, I need to bring back any Open Activities that may or may not be directly related to the account. So I need to NOT use the Account object in the query, but some other way to get Open Activities.
Select Subject, Who.Name, What.Name from task where who.Name = 'John Smith'
Results again in the first 2 rows of my example coming back and NOT the third... I tested it in my org I believe it is because the What.id is different than the other two rows that are retrieved.