Looking up records with IDs

Hi, I have a few tables and i want to trigger an automation when a record is added in table 4 but go up the tables to get a value from table 1.

Houses > Rooms > Items > Reciepts (best example I can think of!)

When a new reciept is added I want to send an email to say here is a reciept which was added to item X in room Y at house Z.

The new reciept has an Item ID in it but that field is an array of item IDs, so at the moment I have my input variable set as:

let itemID = input.config().ItemID[0]

Is that the right way to do this?

Next I want to go into rooms and find the room linked to that item, but again the linked field is an array which is confusing me!

Would love some help,

Thanks!