Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Nithya ts

# Need help in Understand the formula -planning this move to trigger

IF(OR(NOT(ISNULL(SLA_Date__c)),SLA_Date__c > TODAY()),
TODAY()-SLA_Date__c,
IF(Next_Activity_Date__c >= TODAY(),
0,
IF(AND(ISNULL(Last_Activity_Date__c),
TODAY()-DATEVALUE(CreatedDate)>5),
TODAY()-DATEVALUE(CreatedDate)-5 ,
((5 * ( FLOOR( ( TODAY() - DATE( 1900, 1, 8) ) / 7 ) ) + MIN( 5, MOD( Last_Activity_Date__c - DATE( 1900, 1, 8), 7 ) ) )
-
(5 * ( FLOOR( ( Last_Activity_Date__c - DATE( 1900, 1, 8) ) / 7 ) ) + MIN( 5, MOD( Last_Activity_Date__c - DATE( 1900, 1, 8), 7 ) ) ) + 1
-
IF(AND(Last_Activity_Date__c <= DATEVALUE("2016-11-24"),TODAY() >= DATEVALUE("2016-11-24")),1,0) -
IF(AND(Last_Activity_Date__c <= DATEVALUE("2016-12-23"),TODAY() >= DATEVALUE("2016-12-23")),1,0) -
IF(AND(Last_Activity_Date__c <= DATEVALUE("2016-12-26"),TODAY() >= DATEVALUE("2016-12-26")),1,0) -
IF(AND(Last_Activity_Date__c <= DATEVALUE("2017-1-2"),TODAY() >= DATEVALUE("2017-1-2")),1,0)-
IF(AND(Last_Activity_Date__c <= DATEVALUE("2017-1-3"),TODAY() >= DATEVALUE("2017-1-3")),1,0)

))))
Rich Fiekowsky
The first two lines (as formatted) mean that if the SLA-Date has ANY value (isnt null) , return the difference between today and the SLA Date, The End. (I doubt this is what was intended.) (Because of the use of OR(), it is irrelevant whether the SLA Date is future or past.) When it IS null, test Next-Activity date, and if it is future, return 0, The End. Failing that, test whether both LastActivity is null , and it was created over 5 days ago . If both are so , return the number of days old it is, minus 5, The End. Finally, failing that, do the huge obscuure calculation at the end. Luckily the last five lines with IF(AND... can be simplified because Today will be >= all those dates forever. So remove the AND along with those terms. If tehlast-activities are at all recent thee other terms will all be false so it all will be 0  Multiplying by 5 and then dividing by 7 roughly converts calendar days into workdays, while taking something MOD 7 sort of converts days into days-of-the-week. I leave the rest to you!