For a good start of this new year, I decided to share one of my best tips related to SharePoint forms.
The cause of this tip is that I am not fond of using the SharePoint list item ID field to uniquely target an item. It often works fine until the solution has to be migrated (but there are migration tools which preservce the list item ID). I rather use a custom field containing a unique ID. But SharePoint has no way to automatically create an unique value in a custom field which often results in using the list item ID field (I am not fond of using a workflow for this too).
With the introduction of customizing forms with PowerApps, a mechanism is available to add an unique value in a custom field.
This mechanism works as follows:
Using the patch function first in the "OnSuccess" event of the form. When the "OnSuccess" event is fired, the ID of the created item is known and can be used via (The first name "SharePointForm" depends on your situation):
When adding a patch statement, the custom field can be updated with the ID of the list item. This results in a custom field containing an unique value.