How to Use Duration Fields in Dynamics 365 for Sales
By Scott Soulages, CRM Senior Consultant, Arbela Technologies
Duration fields can be used to show a whole number as x number of minutes, x number of hours or x number of days instead of just showing the whole number of minutes to the user. Out of the box, CRM activities such as Phone Calls use the Duration field to track the length of time a phone call lasted. For new Phone Call activity records, the Duration field is set to 30 minutes, but the user can update that prior to completing the phone call activity record.
Prior to the user updating the field, they can click on the Optionset arrow and choose a formatted duration.
Or the user can manually enter a duration. Keep in mind that manual entry is case sensitive and only lower case letters are allowed. For example, “27 Hours” will not resolve and will show an error.
Also, once the user manually enters data into the field, the ability for them to choose from the Optionset goes away.
One of the beauties of the Duration field is that users can manually enter time in minutes, hours or days. And the system is smart enough to round up to the larger increments. For example, if the user enters “65 minutes”, the system will round up to “1.08 hours”. Or if the user enters “27 hours”, the system will calculate the number of days to be “1.13”.
On the back end, the duration field is configured as a Whole Number field with a format of “Duration”. This format is what provides the magic of the translation of minutes, hours and days.
- Like the data type or field type, the format cannot be changed once the field has been created.
- As this field is a whole number data type, the actual data that is stored in the database is the number of minutes. This means that views and forms will show the “1.13 days” but charts, exported data and FetchXML reports will show 1620 minutes.
- Whole number fields with a Duration format may be used as calculated fields. The formula for the example above would be something like “DiffInMinutes(EnteredQueue,Now())”