Luther Posted February 11, 2022 Posted February 11, 2022 Good morning Alfred Fam, I am back again! Trying to understand if it is possible to create a dynamic snippet that can forecast today + 2d, but ignore weekends. For example, let's say today is Monday, Feb 7. In my update to my customer, I will let them know that if they do not respond in two business days I will close their case. So, it will say something like... Quote Good morning CUSTOMER, If I do not hear from you with a meaningful response/review within two business days (_DATE_), I will go ahead and close out our case by 4:00 pm ET on that last day (_DATE_). Where "_DATE_" will be today (henceforth 'n') + 2 days: 2/9/22 The hiccup with the currently available Alfred {datetime +1d} is that weekends are included, so I always have to go back and edit this as we do not count weekend days as "strikeable" days (i.e. days we can count toward a "No Response" closure of a case). Does anyone know if it is possible to intelligently only include business days in a snippet, and if so, how? (i.e. skip weekends) So if I updated a case today, Friday, Feb 11, instead of the snippet saying that I'd close the case on n+2: 2/13/22 (a Sunday), it would instead say that I'd close it on n+2(-weekend): 2/15/22. Any thoughts on how to do this dynamically in a snippet? Thank you so much! Best, Erik
vitor Posted February 13, 2022 Posted February 13, 2022 The dynamic date placeholder doesn’t support that transformation; that would be too complex and it already does a ton as it is. You’ll need a little bit of code. Make a Workflow and add a Snippet Trigger. Connect it to a Run Script Action with default settings and the following code: case "$(date +%A)" in Thursday | Friday) date -v +4d +%D;; Saturday) date -v +3d +%D;; *) date -v +2d +%D;; esac Connect that to a Transform Utility set to Trim white space. Finally, connect that to a Copy to Clipboard Output (check Automatically paste to front most app). In it include your snippet text and use {query} where you want the date to show up. Basically what the code does is check the current day of the week, then add four days to the current date if it’s Thursday or Friday, three days if it’s Saturday; two days any other day. Luther and Vero 2
Luther Posted February 14, 2022 Author Posted February 14, 2022 Thank you SO much once again @vitor! Your help has been so appreciated. Thank you for your time on this. I've set this up just as you shared and applied it to four snippets where I reference the date. AWESOME! Do you know if there is any way to strip out the year from the date format? For example, instead of the snippet (thank you again!!!) spitting out 02/16/22, I could trim off the year and spit out 02/16? Do let me know your thoughts, and thank you so much, @vitor! Best, Erik vitor 1
vitor Posted February 14, 2022 Posted February 14, 2022 @Erik E Thank you for all the thanks! It’s rewarding to know it’s been a positive impact. As to your new question, go into the code and replace instances of +%D with +%m/%d. Luther 1
Luther Posted February 14, 2022 Author Posted February 14, 2022 You are an absolute legend. THANK YOU!!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now