JavaScript method: SCFile.isRecord()

This is a deprecated method as of version 6.1 because it does not use the Service Manager-defined global return codes. It requires using the deprecated File() object with a query or query condition. The isRecord() method verifies that the query or query condition returns a Service Manager record.

Syntax

SCFile_object.isRecord();

Arguments

There are no arguments for this method.

Return values

A Boolean value: 1 (true) or 0 (false).

The method returns a Boolean value of 1 if the File object contains a Service Manager record or returns 0 if the method does not find a Service Manager record.

This method does not use the Service Manager-defined global return codes.

Example

This example does the following:

  • Searches the probsummary table for any incident record you define in the search variable
  • Displays the incident record object and the results of the isRecord() method

This example requires the following sample data:

  • A valid incident record (for example, "IM1005")
  • An invalid incident record (for example "incident")
var incidentQuery;

function findTypes( query )
{
 print( "Searching for incident records starting with " + query + "..." );
 var incidentFile = new File( "probsummary", "number#\""+ query + "\"" );
 if ( incidentFile != null )
 {
  print( "Successfully allocated a File object");
  if ( incidentFile.isRecord() )
  {
   print( "Success. Found incident records starting with " + query + ". The first record is:\n" + incidentFile );
   return incidentFile
  }
  else
  {
   print( "Could not find incident records starting with " + query + "." );
   return null
  }
 }
 else
 {
  print( "Could not allocate a File object." );
  return null
 }
}

incidentQuery = "IM1005";
findTypes( incidentQuery );

incidentQuery = "incident";
findTypes( incidentQuery );