Still getting the same error.  I think the below code also need to be replaced.

if (!value) {
   var gUrl = new GlideURL();
    gUrl.setFromCurrent();
    value = gUrl.getParam("sysparm_id");
    return value;
        }