Skip to main content Stream TDX Bengaluru on Salesforce+. Start learning the critical skills you need to build and deploy trusted autonomous agents with Agentforce. Register for free.

Hi,

 

I need help converting a formula from days to hours. I created the simple formula Last Modified Case Age (Days), which calculates the days between NOW () and the last modified date of the case [NOW() - LastModifiedDate]. 

 

However, we look at cases in hours, specifically, hours between the work week of Monday - Friday.

 

Thank you for your help!

5 risposte
  1. 28 ago 2024, 21:10

    Hi ,

     

    IF( OR( weekday(datevalue(LastModifiedDate))= 1, weekday(datevalue(LastModifiedDate))= 7),

    ROUND( 1440 *

    (( 5 * FLOOR( ( DATEVALUE( NOW() ) - DATE( 1900, 1, 8) ) / 7) + MIN(5, MOD( DATEVALUE(NOW() ) - DATE( 1900, 1, 8), 7) + MIN( 1, 24 / 24 * ( MOD( NOW() - DATETIMEVALUE( '1900-01-08 00:00:00' ), 1 )))))

    -

    ( 5 * FLOOR( ( DATEVALUE( LastModifiedDate) - DATE( 1900, 1, 8) ) / 7) + MIN( 5, MOD( DATEVALUE( LastModifiedDate ) - DATE( 1996, 1, 1), 7 ) + MIN( 1, 24 / 24 * ( MOD( LastModifiedDate - DATETIMEVALUE( '1900-01-08 00:00:00' ), 1)))))),0

    ) + 119,

    ROUND( 1440 *

    (( 5 * FLOOR( ( DATEVALUE( NOW() ) - DATE( 1900, 1, 8) ) / 7) + MIN(5, MOD( DATEVALUE(NOW() ) - DATE( 1900, 1, 8), 7) + MIN( 1, 24 / 24 * ( MOD( NOW() - DATETIMEVALUE( '1900-01-08 00:00:00' ), 1 )))))

    -

    ( 5 * FLOOR( ( DATEVALUE( LastModifiedDate) - DATE( 1900, 1, 8) ) / 7) + MIN( 5, MOD( DATEVALUE( LastModifiedDate ) - DATE( 1996, 1, 1), 7 ) + MIN( 1, 24 / 24 * ( MOD( LastModifiedDate - DATETIMEVALUE( '1900-01-08 00:00:00' ), 1)))))),0

    ))

Caricamento in corso
0/9000