Set date to today

0
In a new edit page i want the date to automatically be set to today and not be editable, is this possible?
asked
4 answers
2

I think there are a couple of ways to be able to do this. 

You can set the default datetime attribute to the current date time

Then you would need to set your input widget to be read only by selecting the never option in the editability section of the widget.

Then depending on how you want the read-only to display you can select your read-only style. 

 

You could also create a custom microflow to set the date time  to the current date time when opening your new edit page. This would make the setting of the date time more flexible. If for some reason the requirement changes to set to day before then this would make it easier.

answered
1

Sure, in your domain model you give your attribute a ‘default value’ of CurrentDateTime and in the tab Acces rules you set the access rights to ‘read’ for this member.

 

 

answered
1

And depending on what you want to do with the date you might want to set it to [%BeginOfCurrentDay%] or [%BeginOfCurrentDayUTC%] depending on if you want to compare it with different time zones.

Regards,

Ronald

 

answered
0

There’s multiple ways to do this.  You would want to use the token [%CurrentDateTime%] to set your datetime attribute. You can either specify in your access rules that this datetime attribute should always be read only. But can also set the attribute to readonly on your page (this is not secure though, because on a database level it is still editable)

 

You can set [%CurrentDateTime%] as your default value of your date attribute in the domain model. But i’m personally not a fan of that. Imo a better way would be to create the object in a microflow which executes on click when opening your NewEdit page and setting the date to [%CurrentDateTime%] in that newly created object, which you pass to your NewEdit page.

answered