I have a record in a table with a field, let’s say: ‘interventionDate’.
Example. Today = 13/3/2020.
Existing record 1: interventionDate = 1/1/2019
Now, there are 3 possibilities:
Edit record 1 should keep date of 1/1/2019 (works fine).
Adding new record (normal add, no in-line or grid): interventionDate = today(13/3/2020) (currently achieved by field setup - add page -default value = CurrentDateTime()
Copying record 1: interventionDate = today(13/3/2020) (similar as adding new record). Other fields keep original values. How to achieve this?
Sorry for the late reply… and thank you!
I made it work the way you suggested but the field is only updated after you click “save” not taking care if the date is changed by the user (which should be possible).
Is there a way to initialise the date when the copied record is displayed, so before the record is inserted?
In that way, the user sees the new date and can correct if necessary.
You can achieve that by simply use “Row_Rendered” server event. Just assign the “EditValue” property of your “interventionDate” field by the current date, for example:
if (CurrentPageID() == “add”) { // only for the Add page
$this->interventionDate->EditValue = CurrentDate(); // just assign EditValue with current date
}