GlideElement - getTableName()

Returns the name of the field's table.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
String Name of the table. This may be different from the table Class that the record is in. See Tables and Classes in the product documentation.

Scoped equivalent

To use the getTableName() method in a scoped application, use the corresponding scoped method: Scoped GlideElement - getTableName().

if (current.approver.getTableName() == "sysapproval_approver") {
  if (current.approver == email.from_sys_id)  {
     current.comments = "reply from: " + email.from + "\n\n" + email.body_text;
 
   // if it's been cancelled, it's cancelled.
  var doit = true;
  if (current.state=='cancelled')
      doit = false;
 
  if (email.body.state != undefined)
     current.state= email.body.state;
 
   if (doit)
      current.update();
} else {
   gs.log("Approval for task ("+current.sysapproval.getDisplayValue()+") rejected because user sending 
           email( "+email.from+") does not match the approver ("+current.approver.getDisplayValue()+")");
}
 
}