I need to have prefixed dates in Microsoft PowerApps model-driven app and could not find any suitable solution from Internet. I found this video from Alireza Aliabadi where message was clear: There is no idea to use the calendar component and somehow allow only one day in a month.

Alireza introduced idea to use drop down instead and this is how I got my idea.

I will add drop down menu with fixed dates, then after user selection I will update the value to the date field hidden on the background with Power Automate – since Business Rule cannot do parseDateTime function. And then I added another Power Automate which will run N times in a year depending the need to update the choices for the drop down menu.

Dataverse table

I created table that has the actual date field and then choice field for the prefixed dates. I use Finnish datetime format d.M.yyyy and I se the value the same way. When the date is 1.3.2025 the corresponding value is 132025. I will tell later on why this is important.

Choice labels and values for the prefixed dates in Power Platform solution
Choice labels and values for the prefixed dates in Power Platform solution

Set the actual date field as hidden in all of the forms for the Dataverse table. Replace it with the prefixed date choice column.

Hide date field and show the drop down for prefixed dates
Hide date field and show the drop down for prefixed dates

Now your user interface has prefixed dates and user can only select from those.

Prefixed dates in user interface
Prefixed dates in user interface

Power Automate flow that copies the value

The prefixed date value needs to be copied to the actual date value. It cannot be done in Business Rule since it needs parsing the Datetime from the string.

Create trigger and limit the trigger to be fired only from the prefixed datestring field. Then create update a row, which parses the string into the Datetime field.

parseDateTime(triggerOutputs()?['_kspiik_prefixeddate_label'], 'fi-fi','d.M.yyyy')
Power Automate flow that copies the prefixed datetime string into datetime field
Power Automate flow that copies the prefixed datetime string into datetime field

Power Automate that updates the choice values

Since we are talking about dates and time goes by all the time, these prefixed dates usually needs to be changed. This can be done with another scheduled Power Automate flow. If are not picky on the exact dates, then you could pass the date conditions and just schedule it running once a month or something like that. Since I want to have exact dates and cannot be sure when it will be running, I scheduled it to be run every day and check the date in the flow logic.

This will be described technically in the next blog post.