InterSystems FAQ rubric
Whether the value of a local variable is an OREF or not can be determined using $IsObject(). Let v be the variable you want to check,
$IsObject1// v is an OREFNote that $IsObject(v) will give an UNDEFINED error if v is undefined.
To avoid UNDEFINED errors, it is recommended to use $Get like this: