Record Creation Override with Relationships

When creating a new record within a collection where records have a HasMany relationship, FA makes two API calls. The first is a POST forest/{modelName} which is followed by POST /forest/{modelName}/{id}/relationships/{hasManyRelationName}.

In our implementation, it is necessary for us to perform some complex validation on the record before insertion, as well as asynchronous, post-insertion logic. The validation and logic require us to know the relation between the new record and its HasMany relation. For example, if we are creating an EmailAlias, we need to know what User that the new record will be associated with before the EmailAlias record creation.

When overriding the POST forest/{modelName} route, the related model (User in the above example) data are not made available in the request. The only time that the related model ID is made available is during the subsequent POST to /forest/{modelName}/{id}/relationships/{hasManyRelationName}.

Since we need to override the record creation, can FA make the relationship data available somewhere in the request? It could be a parameter outside of as to not break any existing functionality, yet support integrations such as ours.

Maybe there’s another way to access this data in the route override that I’m missing. Would love to know what you think about this. Thanks!

Hi @yeti182 :wave: welcome to our community.
Unfortunately it’s not possible today.
I will push this request on our product board.
Thank you to your feedback.