Pop up /Message saying that the object is undefined.
Include an if statement to check if the object is not null and then use the object properties, for example:
var priority = gr. getreference("incident_prioirty")
// do something with the priority