JS Hook accessing record properties is undefined. #4912
-
I can't for the life of me figure out why accessing a record property is undefined in my custom route. (data scrubbed) In my custom route, I added a bunch of $app.logger() to try to troubleshoot this.
I'm originally trying to use the record.ClassName to power 2 more queries, but in the logs of pocketbase it shows that the parameter is "undefined" I tried wrapping the calls in a transaction, still no dice. I've tried every combo that I can find on the docs of PocketBase and I'm running out of ideas. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The record.get("ClassName") |
Beta Was this translation helpful? Give feedback.
The
Record
model is a translated version of the Gomodels.Record
struct, aka. it is not a POJO and to access the schema fields you need to use the designated getter/setters - https://pocketbase.io/docs/js-records/#getset-record-fields: