SUM Query (how to calculate the sum of activities duration)
How to calculate the sum of a user’s activity duration in minutes, for all activities in the last 60 days , and set the value in a field (entity schema query)
Like
Hello,
It can be achieved with the help of the business process. First of all you should add the "boolean" type field on the contact's page and on the activity page and name it for example "Is processed". After that you should create a business process with the "Simple" start event that will read "Contact" object, after that there should be "Read data" element that will read "Activity" object with the data read mode set as "Calculate function" and specify the function value as "Sum" by column "Duration (minutes)" and filter activities by field "Owner" that should have Id from the first "Read data" element that reads "Contacts" object. After that "Modified data" element should be added for the "Activity" object that should change the value of boolean field to "True". Then should go "Modify data" element that will modify data in contact section and will set value of the previous element to the specified field and that will change the value of the boolean field added at the beginning to "True" value and this element should be also interconnected via activity Id in the "How to filter records" block. After that you should make a cycle of this process and it should look like on the screenshot http://prntscr.com/kyx20n (conditional flow 2 should satisfy the condition that boolean field for "Contact" object is "False", conditional flow 4 should satisfy the condition that boolean field for "Activity" object is "False" so to read all activities and all contacts). Don't forget to filter activities by Start and End dates so to get all activities for the last 60 days.
Best regards,
Oscar