Error getting an object with filter from a relation field

I'm trying to filter opportunities using the pointOfContactId as filter, but it's throwing the following error: "Field 'pointOfContactId' does not exist in the 'opportunity' object." Looking into the issue, in packages/twenty-server/src/engine/api/rest/core/query-builder/utils/filter-utils/parse-filter.utils.ts, the **checkFields** function is being called. This function inspects the database fields, and after adding some console.log statements, I noticed that it's looking for pointOfContactId in the fieldMetadata items. However, only pointOfContact exists there β€” not pointOfContactId. Because of that, any attempt to filter by a relation's ID ends up throwing this error. Does that make sense? Let me know if it's unclear. I made a quick fix to get past it, but I'm sure it's not the ideal solution πŸ˜…
No description
3 Replies
Mauricio Natacci
Mauricio NatacciOPβ€’3mo ago
@prastoin could you please check this for me?
Prastoin
Prastoinβ€’3mo ago
Hey @Mauricio Natacci indeed nice catch ! I'm able to reproduce Created an issue https://github.com/twentyhq/twenty/issues/12921 We should fallback the field to the relation key field
Mauricio Natacci
Mauricio NatacciOPβ€’3mo ago
Thanks a lot @prastoin . I really appreciate it!

Did you find this page helpful?