Adding Seconds to Date/Time Fields with Natterbox

Prev Next

For fields such as Conversation Start Time or Conversation End Time, it may appear that only the minutes are displayed; however, this is merely a representation of the data by Salesforce. The seconds are indeed present in the field but are not visible. To view the precise seconds, you can create a formula directly on the object. This formula closely resembles the Complex formula see on the guide that converts seconds into minutes.

You can copy this formula below and replace FIELD_NAME with the field name you are using.

Template

IF(ISBLANK(FIELD_NAME), NULL,

TEXT(DAY(DATEVALUE(FIELD_NAME))) + "/" +

TEXT(MONTH(DATEVALUE(FIELD_NAME))) + "/" +

TEXT(YEAR(DATEVALUE(FIELD_NAME))) + " " +

LPAD(TEXT(
IF(
(HOUR(TIMEVALUE(FIELD_NAME)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))) < 0,
24 + (HOUR(TIMEVALUE(FIELD_NAME)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))),
IF(
(HOUR(TIMEVALUE(FIELD_NAME)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))) >= 24,
(HOUR(TIMEVALUE(FIELD_NAME)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))) - 24,
HOUR(TIMEVALUE(FIELD_NAME)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))
)
)
), 2, "0") + ":" +

LPAD(TEXT(MINUTE(TIMEVALUE(FIELD_NAME))), 2, "0") + ":" +

LPAD(TEXT(SECOND(TIMEVALUE(FIELD_NAME))), 2, "0"))

Worked Example: Creating the field on the object

  1. Navigate Salesforce setup and then the Object Manager.

  2. Find the object, for this example it is the Call Reporting object.

  3. Choose ‘Fields & Relationships’ and then create a new field.

    1. Data Type: Formula

    2. Label the field

    3. Formula Return Type: Text

    4. Formula:
      Copy the template above and replace ‘FIELD_NAME’ with the correct field reference by selecting ‘Insert Field’.
      Please note: we recommend that you insert the field name from the formula editor, this will ensure you get the field name in the right format.

If you wanted to do this for Conversation Answer Time (nbavs__From_Answer_Time__c), the formula would look like this:

IF(ISBLANK(nbavs__From_Answer_Time__c), NULL,

TEXT(DAY(DATEVALUE(nbavs__From_Answer_Time__c))) + "/" +

TEXT(MONTH(DATEVALUE(nbavs__From_Answer_Time__c))) + "/" +

TEXT(YEAR(DATEVALUE(nbavs__From_Answer_Time__c))) + " " +

LPAD(TEXT(

IF(

(HOUR(TIMEVALUE(nbavs__From_Answer_Time__c)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))) < 0,

24 + (HOUR(TIMEVALUE(nbavs__From_Answer_Time__c)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))),

IF(

(HOUR(TIMEVALUE(nbavs__From_Answer_Time__c)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))) >= 24,

(HOUR(TIMEVALUE(nbavs__From_Answer_Time__c)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))) - 24,

HOUR(TIMEVALUE(nbavs__From_Answer_Time__c)) + ($User.nbavs__GMT_Offset__c / (60 * 60 * 1000))

)

)

), 2, "0") + ":" +

LPAD(TEXT(MINUTE(TIMEVALUE(nbavs__From_Answer_Time__c))), 2, "0") + ":" +

LPAD(TEXT(SECOND(TIMEVALUE(nbavs__From_Answer_Time__c))), 2, "0"))

  1. Next > Choose the desired permissions and layouts.

  2. Save!

  3. Add to your report!

Table displaying conversation answer times and durations for various timestamps.

Places to Use This:

Here are some Natterbox fields you might want to add this to:

  • Call Reporting

    • Conversation Answer Time

    • Conversation Start Time

  • Phone Events

    • Time

  • Availability Logs

    • Time