Identify create or update in CreateOrUpdate[Entitiy]

Identify create or update in CreateOrUpdate[Entitiy]

  

Hi guys,

I want to record the date time and the username when someone is create or updating an entry. The problem is in the save action, how can I know that it creates a new entry or updates an entry? Since I just want to insert the AddedDate when it creates and UpdatedDate when it updates.

Solution

Hi Raditya,

You can check the documentation for the CreateOrUpdate entity actions: if the Id of the entity record is NullIdentifier() then a new record will be created in the database, if the Id already has a value, it will update in the database the record that has that Id.

Solution

Oh, my... I forgot. That's even the basic. We can also check in the detail screen input of the entity identifier, is it NullIdentifier() or not. 

Thanks, Jorge