It seems that I was using wo:ERXNonNullConditional and not wo:WOConditional to check the new object, so the check was uncorrect.

My fault...

2012/10/18 Daniele Corti <ildenae@gmail.com>
Hi,
I've a little doubt about the behavior of ERXGenericRecord.isNewObject.

I create some objects that, simply, check, using the Validity framework, the consistency of constraints (not null, unique, etc) when the editingContext save them to the DB. The ValidityException is showed to the user if there is an error.

When I create a new Object, I insert it in the editingContext when I fire the save method, not before.

In order to show a sign to the user that say "New Object" or "Edit Object" in the Object Form, I call the isNewObject() method to check if the object is new or is inside the DB.

The problem occurs when a Validity Exception is thrown and the Object is not saved to the DB. The error is correctly showed to the user, but the isNewObject() method return false, even if the object is not saved to the DB.

Maybe I've misunderstood the behavior of the method isNewObject, but the Documentation of ERXEOControlUtilities.isNewObject(EOEnterpriseObject eo) method (called by ERXGenericRecord.isNewObject() method) say:

Determines if an enterprise object is a new object and  hasn't been saved to the database yet. 
Note: An object that has been deleted will have it's editing context set to null which means this method would report true for an object that has been deleted from the database.

So, I think that my workflow should work.

Thanks for any help
--
Daniele Corti
--
I DON'T DoubleClick




--
Daniele Corti
--
I DON'T DoubleClick