OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums 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 5 years, 6 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #37520

    dawid.zaroda
    Participant

    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
    Replies
  • #37521

    Yevhen Shyshkin
    Participant

    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.

    #37522

    dawid.zaroda
    Participant

    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.

    #37523

    Yevhen Shyshkin
    Participant

    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.

    #37525

    dawid.zaroda
    Participant

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

    Regards

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

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top