Autofilling createdDate and lastUpdatedDate columns

Hello,

I’m trying to set one of my screens up so that when the user goes into the screen and edits a record, the createdDate and lastUpdatedDate columns are autofilled. Both are datatype DateTime columns. The first should reflect the time that the record is added, and the second should change every time the user changes that record.
But, I don’t want the user to have to manually press the calendar button or type in the time.

Is there a way to do this?

Thanks,

Luke

Hi @lucasjohn.gajewski,

For such operations, you can use entity listeners. But in your case, if you base your entities on the StandardEntity class you already have these timestamps in the CREATE_TS and UPDATE_TS columns (find more information here).

Regards,
Aleksey

Thanks Aleksey, I’ll dig into that.

Now, since the value will technically still be entered into the database if I decide to make it Read Only / Mandatory, is there a way for me to simply remove it from the editing screen?

I don’t want the user to even see the two attributes if they don’t have to.

Thanks,

Luke

These attributes will not be shown by default. If you want to show them, add corresponding fields to your fieldgroup, inject them into your screen controller and make them disabled.

I would recommend you to go through this guide, it will answer lot’s of questions.

Regards,
Aleksey

Great, thanks again!