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 either in a report or directly on the object. This formula closely resembles the Complex formula see on the guide that converts seconds into minutes.

This formula can be used both as a custom formula field on an object or as a row-level formula on a report. The only difference would be the way the field name is referenced. You can copy this formula below and replace FIELD_NAME with the field name you are using. These will be different if you are using a report or creating a custom formula.

Template

IF(ISBLANK(FIELD_NAME), NULL,

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

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

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

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

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

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

Worked Example

It is your choice whether to do this directly on a report or if you want to create a new field on the object.

Adding as a row-level formula on a report

Adding as a custom field on the object

Pros

Cons

Pros

Cons

Don’t need permissions to add fields on a Salesforce object

Will need to be added to every report

Only need to create it once for that field and is available to all users

Will need permissions to add fields on an object

Only 1 row-level formula per report (Salesforce limitation)

Creating the field on a report

  1. Navigate to reports in Salesforce.

  2. Create a new report, something like this report.

  3. Click the down arrow next to the ‘Column’ section.

  4. Select ‘row-level formula’

    1. Give it a column name

    2. Formula Output Type= ‘Date/Time’

  5. Enter the formula. Take a copy of the template above and replace ‘FIELD NAME’ with the field. You should select the field from the left tab so you get the correct referejce for that field. For this example we used Conversation Answer Time:
    IF(ISBLANK(nbavs__CallReporting__c.nbavs__From_Answer_Time__c), NULL,

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

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

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

    LPAD(TEXT(HOUR(TIMEVALUE(nbavs__CallReporting__c.nbavs__From_Answer_Time__c))), 2, "0") + ":" +

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

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

  6. Apply!

Please note: we recommend that you insert the field name from the formula editor in either the report or object manager. This will ensure you get the field name in the right format. For example in a report you would use: nbavs__CallReporting__c.nbavs__From_Answer_Time__c and in object manager: nbavs__From_Answer_Time__c.

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: Date/Time

    4. Formula:
      Copy the template above and replace ‘FIELD_NAME’ with the correct field reference by selecting ‘Insert Field’.

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(HOUR(TIMEVALUE(nbavs__From_Answer_Time__c))), 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