Error in Table when displaying related properties

I have a table displaying my Products, so far so good.
Each Product has a Product.customer_id related to a table Customers (containing Customer.first_name and Customer.last_name in addition to Customer.id).

Now in my table displaying my Products, I would prefer to display the last_name of my customer instead of its id.

So I click on the field customer_id in my Products table and I edit the values to add some dynamic values

In the custom code I add :

$queries.customerFetch.data.find(customer => customer.id === currentItem.customer_id).last_name

And in the preview I see that it successfully get the Customer.last_name

But when I confirm and go back to my table, it is now broken:

Any idea why?

Actually, I just had to read the error, the problem was because some Products didn’t have a customer_id…
So I edited the code with:
($queries.customerFetch.data.find(customer => customer.id === currentItem.customer_id)?.last_name) || “unknown”

And it works now, thanks anyway ! :smiley: