I need a the field to reflect a cumulative total time of all appointments on a field on a record.
Throughout the negotiation of a contract, represented by a record for the Negotiated_Contract__c object, a Customer can have appointments.
Previously, when an appointment was started, a timestamp would be placed in the Appointment_Start_Time__c field, and when it ended a timestamp is added into Appointment_Stop_Time__c field. The difference between the Start and Stop Time is calculated and added into the Total_Appt_Time__c field.
Up until now, this was sufficient because there could only be one appointment for each contract negotiation, but now the requirement is that we can multiple appointments for a given negotiation.
With this in mind, when a new appointment is started, the old appointment start and stop times are cleared and new timestamps are entered; I can accomplish this with a workflow, but I also need some way to calculate a cumulative, or running total of the Total_Appt_Time__c field.
Somehow I need the Total_Appt_Time__c to provide a running total. So something like
Total_Appt_Time__c (New) = Total_Appt_Time__c (Old) + (Appointment_Stop_Time__c - Appointment_Start_Time__c)
So if the fist appointment was 40 minutes and the second was 20 minutes, then the Total_Appt_Time__c = 60 minutes.
Is there a way to accomplish this with a declarative solution (workflow, process builder, formula fields, etc) or does it require Apex? And if so, can someone help get me started?