How to obtain the id of referenced records inside a custom widget?

Hi @Emanuele_Gissi

There are only 3 options here.

First is finding the element by name, as in How to Get the Raw Row ID of a Reference Column in Custom Widget? post. It assumes that the display column used for this Ref field is unique, and locating it by text makes sense.

Second option is to add a dedicated formula column that will show you the actual id of the Reference column (just a new formula column that gets the id from the first column).

Third option is to add a formula column with a following formula:

RECORD(rec)

This will expand all Ref columns and instead of the text you will receive an object that has rowId in it. Here is help page for the RECORD function Function reference - Grist Help Center