0

I'm trying to convert the Start Date and End Date, that are part of the standard SFDC Activity object, into hours. It looks like it is not possible to access these two fields (schema names StartDateTime and EndDateTime), from a formula field.

I need to obtain the total number of hours between those to fields. The idea is to use this value to make further calculations that are possible from a formula.

Anyone could give me an idea on how to accomplish this? Thanks in advanced!

2 Answers 2

2

Agree with @Michael, looks like you are talking about teh Event Object. If you want the number of hours you would go to

Setup -> Customize -> Activities -> Activity Custom Fields

Create a new formula field, of type number, and however many decimal places you want. The formula is below.

(DurationInMinutes / 60)

Just make sure you only add it to event layouts and not Task layouts

3
  • Thank you both for your replies. Yes, it is on the Event object. So, I need to write a trigger on the Event object to convert this, correct?No way to do this from a formula, I assume. Thanks again. Commented May 7, 2014 at 13:56
  • No need for a trigger. See the updated answer above. Commented May 7, 2014 at 14:06
  • Thanks sfdc_ninja, that is exactly what I was looking for, much appreciated. Commented May 8, 2014 at 6:19
0

Are you looking at the "Event" object (which is a more specific type of Activity)? If so, it actually uses ActivityDateTime as the start time (unless it is an All Day event) and then either DurationInMinutes or EndDateTime to signify the length.

https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_event.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .