When trying to update the Foreign Key (Smart Relationship) of a record, we receive this error
“An error occured when trying to edit MODEL_NAME : not found.”
When trying to insert a new record, the data are well persisted, the record is created, but the Smart Relationship remains empty even if we specify it in the Form.
Observed behavior
“An error occured when trying to edit MODEL_NAME : not found.”
Expected behavior
(When updating the record) The FK should be updated and not get an error.
(When creating a new record) The FK should be created and not empty when specified.
Failure Logs
404 Error
HttpError: HTTP Error 404: at e.throwHttpErrorIfResponseNotOk
Context
Project name: Elyps
Team name: Elyps
Environment name: dev-cli
Agent (forest package) name & version: “forest-express-sequelize”: “^7.12.3”
Database type: sequelize ORM version “~5.22.5” x MySQL
It’s a belongsTo smart relationship; Person & Account are two models present in different databases so that’s why we are using a smart relationship and not an ordinary FK. Here is how it’s setup:
Indeed, this way of defining a relationship outside sequelize will not allow you to use native Forest Admin CRUD (Create Read Update Delete) in the context of this relationship.
However, your use case should be covered by defining a smart relationship within your customizations