Database Not Exist validation issue

Hi, I have added a server side validation using Database Not Exist for field which is String type field in the table, validation message is displaying as expected but the submit action still create the record. Field i have is Name(string), Code(string), IsOnline(boolean), i wanted to do like if the code is exist do not want to create the record. please help me. thanks

Well if the server side validation runs and shows error the data won’t be submitted.
How are you submitting the form exactly?

Thanks for the reply Teodor, Form submission is as usual server connect form submit action, but it has data detail condition check, if the data detail is not null it run the update action, if not insert action. i have a server action conditionally to use insert, update, delete based on a variable called operation, if the operation is equal to ‘add’ or ‘update’ or ‘delete’ based on that action steps are performed accordingly insert or update or delete, i added the validation like this on the screenshot:

I just noticed, the database not exist validation message is showing for any code i add to the field in the form. strange, like CAD is exist on the database, when add AUD(which is not exist in the database) in the form and submit, still shows the validation message and also adds the record to the database…

I have managed to fix the issue i had, hum… the validate step has to be before the insert step!.
nowhere mentioned that validate step has to be before the insert step, i think its better mentioning it, because usually anyone will start doing insert action first and then if all successfully added to the database then people think to validate the field. in this article there for example. Check if a Database Record Already Exists Before Inserting a New Entry

Well of course you want to validate if the record exists before inserting it :slight_smile:
Steps in the server action run one after another, when the insert runs first, then the validation step will be executed after it, which makes no senses as the data has already been inserted.

1 Like