External Custom Fields

I’m tring to have CustomFieldValues from a separate database. I’ve followed this tutorial, and made a custom plugin:
https://docs.bestpractical.com/rt/4.2.9/extending/external_custom_fields.html

It does perfectly what I want it to, but I need to narrow the list of values by a parameter defined in a custom field of the queue. My problem is, that I can’t find any reference to the queueu, or the ticket when I define an external custom field value, so I can’t reach the custom fields of it.

If I could have any ids I could connect to the database, find the values, and be saved.
Thanks in advance!

You need the custom field value for a queue? You can do $queue->FirstCustomFieldValue( 'Some Custom Field' ); if I am understanding the question correctly