Forum Discussion
Help Restricting Date Choice in List
Hello there! I need to set up a SharePoint list Date field with the following requirements:
1. must flow through to calendar view
2. must be restricted to 5-10 pre-determined dates (these are mostly static but will be added to as time goes on)
Currently, I have a date field with a tooltip of "please enter only 1,2,3,4,5 dates" but am not familiar enough with JSON to add validation. Also, I worry that this is cumbersome for end users as they will have a wide-open calendar but have to select from only 5 dates within that.
I'd love to be able to offer a dropdown choice field with the 5-10 dates as options but I don't know how to do this in a way that flows into the calendar view. When I tried this, they weren't recognized as dates so I couldn't enable the calendar view.
I'm new to SharePoint lists so not sure of best practices here. Thanks in advance!
- Rob_ElliottBronze Contributor
Siriusly one thing you could do is to restrict the columns you show in the new item window but one of them is a choice column with your 5 dates the user can select from:
Then have a simple flow in Power Automate that has the trigger of when an item is created. The first action is then to get the item then to update it. In my example the column we are updating is Birthday and I've formatted the choice column into the correct date/time format with the expression:
formatDateTime(outputs('Get_item')?['body/SelectDate/Value'], 'dd/MM/yyyy')So, a new item is added below:
And it puts it into the calendar view.
This doesn't prevent a user from entering data into other dates, so you might want to have your initial data entry on a different then user a create item action in your flow to add it to the list with the calendar.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)