if(typeof this.selectedAnnots != undefined)
this.selectedAnnots.fillColor = color.red;
app.alert("please select an annotation before continuing")
Yes, but not like this. If no annotations are selected then this.selectedAnnots returns null, so this.selectedAnnots will throw an exception.
So replace your first line with:
Thanks try 67!!! This worked like a charm