I want to create records in Forest Admin for a table “Account”.
The Account table has a “id” primary that is an UUID V4 generated by my backend, not the database.
In forest admin, I found a way to generate the id in the backend like this:
For you need, you can try to activate Read-only for your field. It should be the answer to your need.
To access to this screen, go to Edit layout and go the Settings of your collection, then on the Fields tab and click on the id field.
The replaceFieldWriting method is called only when the field is modified (which is not the case here), so it’s not the customization method that you would need in that case.
Besides the handler runs for updates as well, you only want creation.
You can also hide the “id” field in the creation form (activating the layout editor while the creation form is opened), it will also automatically remove the form validation.
About the replaceFieldWriting we will adapt its implementation to make it work as you expected for the record creation use case.