Formula with sum on date ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jurnet
    Member
    • Aug 2019
    • 35

    Formula with sum on date ?

    Hi,
    Is it possible for an account to have a field and a formula that calculate duration of all calls on account.
    For example that did not work :
    In Account -> Formula : when you update an account
    durationCalls = entity\sumRelated('calls', 'duration');
    duration or
    TIMESTAMPDIFF(SECOND, meeting.date_start, meeting.date_end)
    Or another like
    In Calls -> Formula :
    entity\.AccountDurationField ....... = sum Calls Duration

    I have read the doc and search on Forum but nothing.

    Please HELP me. Thanks
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    You can try this:
    1. Create the integer type field for the Account entity. Let's call it 'totalCallDuration'
    2. Add this formula for the Account entity
    Code:
    totalCallDuration = (entity\sumRelated('callsPrimary', 'duration', 'held'))/60
    . The value will be represented in minutes.
    3. Recalculate formula for all Account records.
    But note that this way will not be automatically show you the changes. To see the new ' totalCallDuration ' field values you should each time make the formula recalculation for Account.

    Also, you can try to automate it with:
    Workflow https://www.espocrm.com/documentatio...ion/workflows/.
    or
    Hook (needs some code development) https://www.espocrm.com/documentatio...lopment/hooks/

    It is quite easy to count duration with Report https://www.espocrm.com/documentatio...guide/reports/.

    Comment

    Working...