Use Xrm.Page.context instead of GetGlobalContext() funtion hope error will be resoved.