How to prevent duplicate records being added to the database

There are two main ways to prevent duplicate records being added to the database.
In this guide, we explain how to set each of these options.

Setting a unique constraint on the database

Inside the data models tab, select the table where you want to prevent duplicate records. Next, click on the
button. This will open up additional options for the table. Scroll down to where it says "Unique Contraints", as shown below.
Next, click on the section "Unique Constraints" to expand the Unique Constraints option & click on
Give the Unique Constraint a name, a description and select the column on which you'd like to apply the new unique constraint. Lastly, make sure the option to Force delete conflicting row has been selected.
In the example below, you can see that the unique constraint is applied the username column. This will prevent duplicate records being inserted into the username column.
to save your new unique constraint. If you now try and enter a duplicate record this will throw an error inserting a new record.

Using the has_record event

This option allows to build a more custom process on what you'd like to do if you find a duplicate record in a database. To use this method, you can create a new Back-End Action, set the trigger component to "Endpoint" and then add the has_record event. See an example of this set up below.
The event will return either true or false, depending on if the condition is met. This value is stored in the variable that you enter in the box marked "As". The value will be true if a duplicate record is found or false if the duplicate record is not found.
After this, you can use the result of the "has_record" event in an entirely custom action and event chain. For example, if you only want to create a record in the database if the has_record is false, then you could add a condition event & then a create statement inside of the condition event, as shown below. An example of this is shown below.