TwentyT
Twenty7mo ago
4 replies
Mauricio Natacci

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 😅
image.png
Was this page helpful?