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
nycsalesopsnycsalesops 

MOD(Today(),7) gives error trying to determine the day of the week

I'm creating a custom object where we will put schedules for client reports we need to run on a weekly, bi-weekly, or monthly basis. Currently we are using recurring scheduled tasks, but I'd like to get away from that for various reasons.

 

For Weekly schedules, I simply want the custom date formula to show the previous Sunday date of the given week based on Today(). The problem is the MOD() function does not directly translate the Today() date into a date value and yields an error. I've seen cases where MOD(Today() - DateValue(createddate),7) works, however MOD(Today(),7) errors out.

 

This is the code as I imagined it should be:

Today() - MOD(Today(),7) + 1

 

Any guidance is greatly appreciated.

IspitaIspita

Try this and check if it serves your purpose:-

 

Today() - MOD(DAY(Today()),7) + 1

 

Hope this helps ? If not, let me know what didn't work, or if so, please mark it solved.