Avoid Item Creation if value already exists for Unique Column


I have a column in a document library which requires unique values.

If an error occurs the item is still created.
This results in an orphaned document set, which will cause some problems.

I am using a custom submit button returning fd.save().

Ideally the item would not be created, alternatively it could be deleted on form close if error or if no Job Number in SharePoint item column.

I understand this is a SharePoint error, so not sure if forms can resolve the issue.

Any Ideas?

Hello @AdamSmith,

I'm not sure I fully understand the case.

Is that Edit form? Are you using any code to create a folder?

Could you please provide more details so I could reproduce the case on my side.

Thank you!