Wednesday, December 19, 2018

Custom Field: Get the Difference of Two Date Fields Using an SQL Expression

1. Navigate to Customization > Lists, Records, & Fields > Entity Fields > New

2. Create the Custom Fields

  • Custom Field 1. 
    Label = Date Created
    ID = _datecreated
    Type = Date
    Store Value = T
    Applies To = Customer
    Display > Subtab = Main
  • Custom Field 2.
    Label = Date Closed 
    ID = _dateclosed
    Type = Date
    Store Value = T
    Applies To = Customer
    Display > Subtab = Main
  • Custom Field 3.
    Label = Days Open
    Type = Date
    Store Value = F
    Applies To = Customer
    Display > Subtab = Main
    Validation and Defaulting > Formula = T ; Formula field = ({custentity_dateclosed}-{custentity_datecreated})

3 . Pull up any Customer record > Fill out the custom fields. For example:

Date Created = 9/1/2012  
Date Closed = 9/3/2012 

4. Click Save.

5. Days Open field should show the value of 2.

No comments:

Post a Comment