+ Start a Discussion
Ramon PereiraRamon Pereira 

SOQL in ActivityHistories

staff,

 

I need to create a SOQL return all the activities that were carried out by a particular User.
I created this SOQL, however it returns me bills that have not passed on the activities of the User where clause.

Could you help me please.

 

	Select a.name, (Select subject, CreatedBy.Name from activityHistories where CreatedById = '005A0000001AVM1' ORDER BY ActivityDate ) from account a 

 

 

thank you

sandeep@Salesforcesandeep@Salesforce

Here I am considering owner of 

List<activityHistory> ListOfActivityHistories = new List<activityHistory>();

for( Accout a : [Select a.name, (Select subject, CreatedBy.Name from activityHistories createdbyId ='005A0000001AVM1' where ORDER BY ActivityDate ) from account a ])

{

       for(activityHistory AH : a. activityHistories)

       {

           ListOfActivityHistories.add(AH);

       }

}

 

Now this is your Activity histroy List 

ListOfActivityHistories

 

If this helps you please give me KUDOS and mark this as solution.