How can i prevent the change in a form in case of error ?

Hi again, I’d like to ask about how to stop the changes in a form,

I mean, I’m using modifiedField() table method to do some sort of controlling conditions, In some cases the value shouldn’t be updated in database which can’t be done using this method (modifiedField()) , I searched and i found that i should therefore use update() method instead, My question is how to use it ? cuz after I checked it I couldn’t find any _fieldId ?

Thanks .

You can use the method validateWrite to validate data before saving to database.

If you want a field-level validation, use validateField() instead of modifiedField(). The names should make clear that the former is for validation and the latter is called when the field was modified.

Thank you Nuno But i need on field-level .

That’s what i needed, Thank you very much, One last question, the super() method is what does that update on the database, right ? so in case the value didn’t match the requirements then skipping the update would be done by not calling it, Am i right ? Or maybe super() method does some sort of validation as well and i just need to return “false” in order not to validate the field ? Thanks again

super() in general calls the parent class. In many cases, the parent class is in AX kernel and contains whatever kernel logic Microsoft put there.

If you mean modifiedField(), it doesn’t actually save anything to database, but it does update the buffer in memory.

If you meant update() on table, then updating database is one of many things that is does (triggering alerts is one of the other things).

super() in validateField() does run some validations (such as validating number formats), therefore you should call it. Return false if your validation failed.

I really appreciate your help sir , I got what I need, Thank you very much for your time and effort .