function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sanjana RajasekarSanjana Rajasekar 

Business Days - Help

Hi ,
I have a case records with status as Resolved. The Last modified date is captured as we change the status. Considering this dateTime field, I need to run a schedule flow to update the status as Closed automaticaly after 3 business days from the Resolved status.

Formula of type Number  : NOW() - record.lastmodified date 
This will return number and check if greater than 3,and updateto  closed. But this is considering weekends.
How can I achieve this considering Business Days.
Thanks in Advance!
VinayVinay (Salesforce Developers) 
Hi Sanjana,

You can try below steps.
  • Run the scheduled flow every day
  • Use a decision block as the first element to decide if the rundate is a business day. If yes, continue to the other flow elements. If not, do nothing
  • Decide whether it is a business day can be as simple as a formula that looks to see if the run date is a weekend day. If you need to include holidays, you can use an invocable apex to decide if it is a holiday
https://salesforce.stackexchange.com/questions/4161/method-to-check-whether-a-date-is-a-holiday

Please mark as Best Answer if above information was helpful.

Thanks,
Sanjana RajasekarSanjana Rajasekar
Hi Vinay,

To count the number of business days between two dates, I tried below formula though It gives incorrect number of business days. 
Ex: If Start date is 31/05/2023 and Today : 1/6/2023 Actual business day is 1 but resulting to 5. Not sure what is happening 
 
IF(NOT(ISBLANK({!$Record.StartDate__c})), 

    CASE(MOD(6 - WEEKDAY({!$Record.StartDate__c}) + MOD(TODAY() - {!$Record.StartDate__c}, 7), 7),

        0, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 5,

        1, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 4,

        2, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 4,

        3, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 4,

        4, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 4,

        5, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 3,

        6, (TODAY() - {!$Record.StartDate__c}) / 7 * 5 + 3,

        9999),

    0)

 
Austin SawyerAustin Sawyer
To automatically update the status from "Resolved" to "Closed" after 3 business days, considering business days and excluding weekends, you can create a formula field that calculates the elapsed business days between the "Last Modified" date and the current date. The formula should account for weekends and calculate the difference in business days. You can contact us on this business website https://biddingestimate.com/ for further guidance. Regards
Arun Kumar 1141Arun Kumar 1141
Hi @Sanjana,

You should create a formula field with the return type as a checkbox (Boolean) value,
now make a formula as given below
IF(AND((TODAY() - StartDate__c)  >= 3,  WEEKDAY(TODAY())  <> 1, WEEKDAY(TODAY())  <> 7 ) ,true, false)
Now schedule your flow daily and check whether the formula field is true. If it is found true then update your case status from "Resolved" to "Closed".

Please mark it as Best Answer if the above information was helpful.

Thanks
nathan banenathan bane
Hi,
To achieve this considering business days, you can use the WEEKDAY function in the formula to check if the last modified date falls on a weekend (Saturday or Sunday). If so, you can add additional days to the 3-day period to account for the weekend. For example, you can add two extra days if the last modified date falls on a Saturday and one extra day if it falls on a Sunday. This way, your schedule flow will update the status to "Closed" after the correct number of business days. Hope this helps! Good luck! 😊 For more visit : https://garagedoorsrepairfranklin.com/garage-door-opener-repair/
james haringtonjames harington
Hi there,
To achieve this considering business days, you can use an Apex code with a loop to calculate the elapsed business days between the Resolved and current date. Then, you can update the status to Closed after 3 business days. Let me know if you need further assistance with the code. Thanks! For sharing this : https://starbuckspartnerhours.us/
 
darron clarisondarron clarison
Hello,
Your approach is on the right track. To factor in business days and exclude weekends, you could modify your formula by using functions like WEEKDAY() and CASE() to handle different scenarios for day counts. This way, you can accurately calculate the time and trigger the status update to Closed after 3 business days. If you need further assistance with the specific formula, feel free to share more details. Best of luck, and I hope this helps you achieve the desired automation Check : https://topfollowapks.net/firafollower-apk/
Best regards.
James Smith 347James Smith 347

To achieve this in a scheduled flow while considering only business days (excluding weekends), you can create a formula that calculates the number of business days between the Last Modified Date and the current date (NOW()), and then update the status to "Closed" if the calculated number of business days is greater than or equal to 3.
For more information Check: https://starbuckspartnerhour.net/starbucks-partner-central/

Thanks in advance!