How do I get the ID of a newly saved data within the same Save action?
Application Type
Traditional Web

I'm trying to create a log about an item being created on the ItemDetail screen. I have no problem on edit function (same screen) since I am passing an Id and that's what is being save in logs table. But during adding new item, where I just pass NullIdentifier() in the id parameter, the id that is being save in logs table is 0.

I have tried to use to get the id from GetItem aggregate in Preparation and the id from ItemForm but it still returning 0. Any idea how to achieve this?

Note that after the Item_CreateOrUpdate, I am trying to call ItemLogs_CreateOrUpdate. both are in SaveItem screen action. I wonder if this is possible.

this is something I tried but to no avail.

If(ItemId = NullIdentifier(), ItemForm.Record.Item.Id, ItemId)
Rank: #70

Hi Kenneth,

Your action Item_CreateOrUpdate action should be returning the Id created / updated which you can use as an input for your ItemLogs_CreateOrUpdate. Every Create / CreateOrUpdate CRUD actions return the Id in the Output. For instance, on my Entity Color, you can see the Id as an output on its CRUD actions:

Hope it helps.


Rank: #4696

Thanks! got it now!