Use a Flow formula resource to block or allow dates so that only dates other than the month\’s first Monday and last Friday are accepted in a Screen Flow.
Overview
When collecting dates in a Salesforce Screen Flow you may need to prevent users from selecting two special days — the first Monday of the month and the last Friday of the month. Instead of adding Apex or extra Get Records, you can use a single Flow Formula resource to compute those special dates and validate the screen input.
What you need
- An input Date variable/Screen component (e.g., {!SelectedDate}).
- A Formula resource (Return Type: Date or Boolean depending on your approach).
- A Screen validation that references the formula or a Boolean formula that evaluates to true when the date is allowed.
Step-by-step
- Create a Date screen input (store in {!SelectedDate}).
- Add a Formula resource (Date) that calculates the first Monday of the selected date\’s month and the last Friday of the month. Example logic is below.
- Add a Screen component validation that disallows the date when it equals the first Monday or the last Friday — or build the formula to return a Boolean and reference it directly.
Example Formula (conceptual)
Below is a conceptual Flow formula (structure using Flow formula functions). Adapt the variable names to your flow and test thoroughly in Sandbox.
/* Replace SelectedDate with your Date resource (e.g., {!SelectedDate}) */
/* First day of month */
FirstDay = DATE(YEAR(SelectedDate), MONTH(SelectedDate), 1)
/* Offset to the first Monday (WEEKDAY: 1=Sunday, 2=Monday, ... 7=Saturday) */
OffsetToMonday = MOD(9 - WEEKDAY(FirstDay), 7)
FirstMonday = DATE(YEAR(SelectedDate), MONTH(SelectedDate), 1 + OffsetToMonday)
/* Last day of month */
LastDay = DATE(YEAR(SelectedDate), MONTH(SelectedDate) + 1, 1) - 1
/* Offset back to the last Friday (Friday = 6 if Sunday=1) */
OffsetFromFriday = MOD(WEEKDAY(LastDay) - 6, 7)
LastFriday = LastDay - OffsetFromFriday
/* Validation: true when SelectedDate is NOT first Monday or last Friday */
NOT(SelectedDate = FirstMonday || SelectedDate = LastFriday)
Use the formula in Screen Validation
In the Screen element, open the field validation for the Date input and reference the Boolean expression (or compare the SelectedDate to FirstMonday/LastFriday and show an error message).
Best practices & testing
- Build and test the formula in a Sandbox across months where the first day is any weekday to make sure the offsets compute correctly.
- Consider timezone and Date vs DateTime differences — store and compare only Date values.
- If you need localization or business calendars, adapt the logic or consider a small Apex action for complex rules.
By keeping this logic in a Flow formula you avoid extra Apex or data lookups and keep the flow declarative and maintainable.
Why this matters
Validating special dates directly in Screen Flows reduces development overhead, improves UX by preventing invalid submissions, and keeps logic transparent for admins. For Salesforce admins and developers this is a lightweight approach to enforce date rules without code.
Categories: Salesforce Tips








Leave a Reply