Scoped GlideElement - getLabel()

Returns the object's label.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
String Object label

var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sysapproval);
gr.query();
while(gr.next()) {
    var nicePrice = gr.price.toString();
    if (nicePrice != ) {
        nicePrice = parseFloat(nicePrice);
        nicePrice = nicePrice.toFixed(2);
    }
    template.print(gr.number + ":  " + gr.quantity + " X " + gr.cat_item.getDisplayValue() + " at $" + nicePrice + " each \n");
    template.print("    Options:\n");
    for (key in gr.variables) {
      var v = gr.variables[key];
      if(v.getGlideObject().getQuestion().getLabel() != ) {
         template.space(4);
         template.print('     ' +  v.getGlideObject().getQuestion().getLabel() + " = " + v.getDisplayValue() + "\n");  
      }
    }
}