Developers often use unique, mandatory background fields that cannot be input by the user to track records in a table. When importing data from a file or another database to a table like this (whether using User mode File>Import command or programmatically) it is important to make sure that this field is populated correctly. A good method of doing this is using Triggers.
Note that triggers run even when importing data!
The database event On Saving New Record Event is useful for this. The Trigger method is run when importing via code or User mode.
Note: It is likely that in your Trigger method you may need to query the table that the record is being saved into to make sure that the value you are going to assign is unique. A caveat of Triggers is that you cannot change the Current Selection in the Trigger method. For that reason use the SET QUERY DESTINATION command to set the destination elsewhere instead of the Current Selection.