Perl API GlideRecord

ServiceNow Perl API - GlideRecord perl module is an object representation of a GlideRecord object used to access your ServiceNow instance.

Constructor

Constructor Description
new

new(Configuration object, Table name, optional caller object)

$config = ServiceNow::Configuration->new();
$glideRecord = ServiceNow::GlideRecord->new($config,'incident',$me);        

Constructor. Access to the ServiceNow Glide Record object. The caller object is optional unless creating a Class that inherits GlideRecord (See any class in ServiceNow/ITIL for example).

Subroutines

Subroutines Description
insert

insert(optional hash argument)

Example:

$glideRecord->insert();

Inserts glide record into Table. Returns sys id.

setValue

setValue(name, value)

Example:

$glideRecord->setValue('caller_id','56');

Sets element within Glide Record with name to specified value. Will not effect the GlideRecord within the Table until inserted or updated.

addQuery

addQuery(name, value)

Example:

$glideRecord->addQuery('number','INC1000014');
$glideRecord->query(); 

Refines query to include only the Glide Records with field name=value.

query

query(optional hash arguments)

Example:

$glideRecord->query();

Returns all Glide Records in the Table with specified query. Step through the Records with the next() call.

next

next()

Example:

if($glideRecord->next());

while($glideRecord->next());

Steps through the results of Glide Record query. Returns TRUE if more elements exist.

update

update(optional hash arguments)

Example:

$glideRecord->setValue('name','value');
$glideRecord->update();

Updates Glide Record in table with the Glide Record object. Changes to Glide Record object will not take effect until updated or inserted. Returns sys_id of record on success, undef of failure.

getValue

getValue(name)

Example:

$glideRecord->getValue($name);

Get value of element name in GlideRecord. Returns string value of element.

getDisplayValue

getDisplayValue(name)

Example:

$glideRecord->getDisplayValue($name);

Gets display value of element name in GlideRecord. A display value would be the string name, instead of the sys_id in the case of a reference field, or the string value instead of the number value in the case of choice fields.