Skip to main content
May 1, 2025
Solved

Custom Record Fields

  • May 1, 2025
  • 5 replies
  • 1 view

Hi Team, 

I am using custom record field for date difference function (a!customFieldDateDiff), however the problem is that this function rounds off the date to floor. eg 10.99 Days will be 10 Days.

do we have any other function which will do the job correctly ? 

Thanks in Advance 

    Best answer by shyams439803

    Hi there,

     

    To get a more accurate, floating-point result Instead of calculating the difference in days directly, calculate the difference in hours and then divided it by 24 to convert it back to days. Here's what it looks like:

     

    a!customFieldDivide(
      a!customFieldDateDiff(
        startDate: 'recordType!{46be8507-bc40-4c95-8264-c1b9636a277b}AL Customer Data.fields.{fae1dc47-fb25-4dd2-ad5a-539b51898180}createdOn',
        endDate: now(),
        interval: "HOUR"
      ),
      24
    )

     

    This approach gives you the decimal day difference, like 10.99, instead of just 10.Now you can use cieling or integer functions in interface according to your requirements.

    Hope this helps!

    5 replies

    stefanhelzle0001
    May 1, 2025

    I do not know of another function to do this. In the end, it is open to interpretation whether this calculation is correct or not. It is called "DateDiff", not "DateTimeDiff".

    May 2, 2025

    If I'm understanding correctly flooring 10.99 to 10 should be your expected outcome because 10.99 days is fewer than 11 days.  Are you trying to find more than just the whole number for days?   

    shyams439803
    May 5, 2025

    Hi there,

     

    To get a more accurate, floating-point result Instead of calculating the difference in days directly, calculate the difference in hours and then divided it by 24 to convert it back to days. Here's what it looks like:

     

    a!customFieldDivide(
      a!customFieldDateDiff(
        startDate: 'recordType!{46be8507-bc40-4c95-8264-c1b9636a277b}AL Customer Data.fields.{fae1dc47-fb25-4dd2-ad5a-539b51898180}createdOn',
        endDate: now(),
        interval: "HOUR"
      ),
      24
    )

     

    This approach gives you the decimal day difference, like 10.99, instead of just 10.Now you can use cieling or integer functions in interface according to your requirements.

    Hope this helps!

    May 5, 2025

    Thanks everyone for your responses, However this solution aligns with my requirement.

    Thanks again for efforts.