How to get the record id in the dynamic page?

Hello

I am a bigginner of VelobyWIx.
I put a preset like ‘Properties’ and confirm successfully the dynamic pages of Properties(all) and Properties(title) in place.

In the edit page of Properties(title), I want to get the id whose page is on the web screen in order to write specific codes depending on each record.
I tried to write code below.
if ($w(‘item22’).text === ‘HOUSE1’) {xxxxxx},
where I unfortunately confirmed the ‘text’ still holds the default value rather than retrieving the value of linkking item filed in the collection table.

How do I know the current record id, which appeared on the Web page ?

I appreciate any advice.

Thanks,

In other word, how can I get the value of the linking field in the collection table. e.g. simple example

Result: console.log($w(‘#bedrooms’).text); ===> Bedrooms ( field defult value?)
Expect: console.log($w(‘#bedrooms’).text); ===> 2 ( value of the collection table )
On the Web screen, the value of 2 is being displayed.

Thanks,

I found a solution myself below.

let itemObj = $w ( “#dynamicDataset” ). getCurrentItem ();
let current = itemObj ._id;
console . log (current);

This is what I wanted to know.