OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums OroCRM OroCRM – How do I? Questions Repository which loading all account activities

This topic contains 4 replies, has 2 voices, and was last updated by  dawid.zaroda 1 year, 1 month ago.

  • Creator
  • #37520


    I need to load all Activities of Account in SQL (especially date start of activity), how can I do it? I tried joins, but relations in database are in table with generated key, so it won’t work everywhere.
    Activities which I want to load: calls, emails, events

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #37521

    Hello, Dawid.

    The easiest way to do that is to call ActivityList repository and request an appropriate query builder:

    As you can see you may pass multiple activity classes. In the end application will generate an SQL like that:

    There is created_at field at the selected data – I guess this is what you need.



    Hello Yevhen,

    thank you for your response, I will check that and maybe it will be enough :)

    Also I have another question: what if I want to load this date for all accounts in database and filter results by my conditions? Performance is not very important, because this code will run only at night, one time.


    There are two solutions.

    1) Pass all account IDs there – looks like method can work with array of IDs as well.

    2) Create your own Query Builder inspired by the code at ActivityListRepository, but replace condition ‘accountId = X’ with ‘accountId IS NOT NULL’ – I guess it should be enough to get all required activities.



    Thank you for your help – I will try this solution.


Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No