You need to sign in to do that
Don't have an account?

How we can Query all Activities for a Contact ?
Hai friends,
Can you anybody help me to query all Activities in single query for a contact.
Thanks in advance
sforcehari
You need to sign in to do that
Don't have an account?
Hai friends,
Can you anybody help me to query all Activities in single query for a contact.
Thanks in advance
sforcehari
Ok
You can do that in this way,
Contact[] Con=[select id from Contact];
Contact[] Activitycon=[select id,lastname,(select id,subject,whoid from Events where whoid in: ct),(select id from Tasks where whoid in : ct) from Contact];
All Answers
Hi
You can do it in this way..
Contact[] Con=[select id,lastnname from Contact];
Task[] Tasklist=[select id,subject,whoid from Task where whoid in: Con];
Event[] Eventlist=[select id,whoid from Event where whoid in: Con];
Since you cannot write query on Activity....
Thank u Sree,
But i need them in single query. How we can get all events and tasks for a contact ,with in single QUERY?
Thanks in Advance
sforcehari
Ok
You can do that in this way,
Contact[] Con=[select id from Contact];
Contact[] Activitycon=[select id,lastname,(select id,subject,whoid from Events where whoid in: ct),(select id from Tasks where whoid in : ct) from Contact];
Thank you,
It's working fine..Thank u so much.
Regards,
Sforcehari
If you want to get activity Histories in a single query use this -
List<Contact> Cons = [select id,(select id from activityHistories) from Contact];