DataClass.get New Record

It seems that if you have a new record you are unable to create an entity from it. I have tried both .get and .query. In my case I’m trying to test for values before saving the record. This is web-based not a form.

$litter:=ds.Litter.get([Litter]UUID)

$liltter is null for a new record but works okay have a record. Same for query. See image below.

For example I am trying to do

If ($litter.MotherID=Null) //ORDA
vs
If ([Litter]MotherID="")

new record? Saved or just in memory?

If you haven’t saved the record to the database, then obviously a “query” or “get” won’t find a corresponding entity, the primary key is not registered yet.

In theory you could convert the record to JSON and call entity.fromObject() but I feel you might be better off if you commit to either ORDA or classic in this piece of code.

Thanks, I thought so. Its not saved as need to check before saving so reverted to classic for this method.

think about Classic/ORDA as if you would use two processes in parallel.
In two processes with Classic, process #2 can only see the record when it is saved from #1

Now with ORDA, each entity is a kind of new process. Each entity can have it’s own “copy”, it’s own “version” of a record. To load it (by get or query), it needs to be saved, else it is not a record, else it is only a memory object.