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
cwoodcwood 

Confusing results with RecurrenceDayOfWeekMask

Let's say I create a new event and set it to recur monthly on the last day of the month. The created SObject includes these fields and values (among others):

IsRecurrence = 'true'
RecurrenceType = 'RecursMonthlyNth'
RecurrenceInterval = 1
RecurrenceDayOfWeekMask = 127
RecurrenceInstance = 'Last'


But what that looks like to me is the last Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday of the month. Am I misunderstanding the RecurrenceDayOfWeekMask field?

Or, since there's no way in the SFDC UI to specify multiple Nth days, should I take the '127' value to be a special case meaning "day", as in the UI? And if that's true, is there a way, using the API, to create an event that recurs on the last Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday of the month?

If I change the event to recur on the last Sunday of every month, RecurrenceDayOfWeekMask is set to '1', as I would expect.

Thanks!
-Charlie
Matt P McMatt P Mc
I realize this is 13 years old now, but just in case others are looking for it (like I was), I think I figured it out - it's binary counting.
1 - Sunday
2 - Monday
4 - Tuesday
8 - Wednesday
16 - Thursday
32 - Friday
64 - Saturday
Then, start adding values to get the combination.
127 - Every day of the week.
cwoodcwood
I absolutely love that you answered my 13-year-old question! Thanks, Charlie
Matt P McMatt P Mc
I even took a few minutes to build out a quick spreadsheet to calculate it
 SMTWTFS 
 1248163264 
WHICH DAYS XXXXX 62
        EQUALS

Where the 62 is, put the following: =SUMIFS(B2:H2,B3:H3,"X")