Get item's custom field data for a custom button/function

Get item's custom field data for a custom button/function

Hi, I’m working on a custom button for the Invoice details page in Zoho Books.

I need to calculate a Tourism Levy only on some items. I already created an Item custom checkbox field:
cf_tourism_levy

In Zoho UI, the field is there and I can see it on the invoice item lines as true, so the data exists.

My issue is in Deluge:

- invoice.get("line_items") does not seem to expose cf_tourism_levy
-  I also tried reading the item with zoho.books.getRecordsByID("items", org_id, item_id, "myconnexion")
-  the connection was created successfully and includes items = ALL
-  but I still could not reliably get that custom field for use in the script.

So my question is:
From an Invoice custom button script, what is the correct supported way to know whether an invoice line’s item has Item custom field cf_tourism_levy checked?

More precisely:

Is that item custom field supposed to be available directly in invoice.line_items ?
If yes, what is the exact syntax?
if not, what is the proper supported way to fetch it in Deluge?

For testing, my script works if I apply 2% to all invoice lines, so the levy calculation itself is fine. The only missing part is identifying which lines should attract the levy.

EDIT: I found out now that the API connection can NOT read items at all. I have set the connection both to items=ALL and items=READ but all my codes always get a 57...


Thanks in advance
Kind Regards
Fred