Issue Filtering Custom Field in Invoice Line for Selected Product

I have added a custom field in the products module (a code related to the product) and want to display it in a separate column in the invoice. To achieve this, I added an attribute in the invoice line settings and used the following syntax to retrieve the custom field value:

table_name:label_field:id_field::filtersql
product_extrafields:hsnsaccode:rowid

This syntax successfully fetches all available values of the custom field “hsnsaccode” that I added. However, I need it to display only the value related to the selected product in the invoice line, but I am unable to apply the correct filter.

How can I modify the filter to ensure that only the hsnsaccode of the selected product appears in the invoice? Any guidance would be appreciated.