Getting warning for unsaved changes when nothing has changed

0
Hi All,  I have used ‘objectHasChanged’ method from ‘Object Handling’ module to detect whether my object (product details) has changed since previous ‘save’ action. Ideally, I expect the warning for unsaved changes to pop up on clicking the ‘Back’ / ‘Exit’ button only when I have changed one or more attributes.  This works as expected all the time, EXCEPT when I open the create object form for the very first time. When I launch create object form and click the ‘Back’ button, the warning about unsaved changes is still displayed, which is not required.  Could it be because I have set default values for some attributes in the domain model (E.g. enumeration values for development country is set to ‘Netherlands’ by defaul), that treats the product details as ‘modified’?  Any workaround for this problem please?    
asked
1 answers
1

Most probably because the object has just been created and not yet committed in database so it is returning True in the java action.

Use ObjectIsNew Java action, if it returns False then you go to ObjectHasChanged action, else skip the objecthaschanged java action, in the microflow.

answered