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
Peter JefferyPeter Jeffery 

previous working day

I was kindly shown how to have a checkbox ticked if the created day or a record was the previous working day (not including weekends), I would now like to adapt this so the checkbox is ticked if the created date is greater or equal to the last working day (not including weekends) but less than today.

The previous post is here:

https://developer.salesforce.com/forums/ForumsMain?id=9060G000000BcNo

Thanks in advance.
Best Answer chosen by Peter Jeffery
Ahmad J. KoubeissyAhmad J. Koubeissy
So try to edit the formula field "Created Yesterday" to this:
IF(Today_Name__c='Monday' && DATEVALUE(CreatedDate) >= Today()- 3 && DATEVALUE(CreatedDate) < Today(),true,IF(DATEVALUE(CreatedDate) =Today()- 1,true,false))

Dont forget to mark as best answer. thank u :) 

All Answers

Ahmad J. KoubeissyAhmad J. Koubeissy
before, you were checking if the record was created yesterday.
now lets assume that today is Tuesday, the last working day will be monday. lets say thât you created a record on monday, created yesterday will be true. now if you change the condition, the value will be false. even for the rest day it will be false. this doesnt make sense. can you give more details plz
Peter JefferyPeter Jeffery
Apologies for the late reply and poor explanation, with the original solution records created on Saturday or Sunday wouldn't be captured but I would like these to be included on Mondays:

Mon = True if created previous Fri, Sat, Sun
Tue = True if created Mon (yesterday)
Wed = True if created Tue (yesterday)
Thu = True if created Wed (yesterday)
Fri = True if created Thu (yesterday)

Regards,

Pete
 
Ahmad J. KoubeissyAhmad J. Koubeissy
So try to edit the formula field "Created Yesterday" to this:
IF(Today_Name__c='Monday' && DATEVALUE(CreatedDate) >= Today()- 3 && DATEVALUE(CreatedDate) < Today(),true,IF(DATEVALUE(CreatedDate) =Today()- 1,true,false))

Dont forget to mark as best answer. thank u :) 
This was selected as the best answer
Peter JefferyPeter Jeffery
Thanks again.
Zoe DenverZoe Denver
Thanks for the post. I love playing online games, and I big fan of gambling. You can visit https://ascotcamogli.it/ and learn about the best bookmakers and gambling.
Katrine LupeKatrine Lupe
I am working on my new project. A lot of work and coding
I distract myself at https://betsofa-ca.com/  
Michael Nelson 48Michael Nelson 48
I had many reasons to start playing online casinos and learn how to make money from it, which I will tell you about later. And now I want to recommend the site https://online.casino/, where I spend a lot of my free time, because I have already seen for myself that this is a very reliable casino with a high percentage of winnings.