[SalesForce] Subtract an event’s start date time from the event’s end date time (Activity)

I am trying to create a custom event field. As you probably know, the way to do that is to create a custom activity field since an event is a special type of activity.

I want to subtract an event's start time from the end time so I can determine its length.

However, when I build my formula, I cannot choose the event start/end fields. All I see are activity fields, not event fields.

What I am looking for:

  • EndDateTime
  • StartDateTime

Event fields

But when I build my formula, I cannot use these names. I get Error: Field EndDateTime does not exist. Check spelling.

I get this whether I try

  • EndDateTime - StartDateTime or
  • EndDateTime - ActivityDateTime

Formula building in Salesforce

So why cannot I use the event fields in my formula? What is their real field name? This is frustrating.

Thanks everyone.

BTW this relates to another question I asked here.

Lastly, I found the Salesforce field name reference and it does list the fields I want to use.

Best Answer

DurationinMinutes is a standard field which calculates time duration in minutes between StartDateTime and EndDateTime

You can create a formula field based on DurationinMinutes For e.g. DuratoininHours would be

(DurationInMinutes / 60)
Related Topic