JavaScript method: SCDatum.toArray()

This method converts an HPE Service Manager Datum object into a JavaScript array.

Syntax

SCDatum_object.toArray();

Arguments

There are no arguments for this method.

Return values

A JavaScript array and RC_SUCCESS or one of the other global return code values.

Example

This example does the following:

  • Searches the probsummary table for any incident record you define in the search variable
  • Displays the incident record as a text string
  • Converts the contents of the action field into a JavaScript array

This example requires the following sample data:

  • A valid incident record number (for example, "IM1010")
  • An incident record with an action field value (for example, "IM1010")
var incidentID;

function findIncident( id )
{
 print( "Searching for Incident record: " + id + "..." );
 var incidentFile = new SCFile( "probsummary" );
 var rc = incidentFile.doSelect( "number=\"" + id + "\"" )
 if ( rc == RC_SUCCESS )
 {
  print( "Success. found Incident record:\n" + incidentFile.getText() );
  print( "Converting the action field to a JavaScript array..." );
  var a = incidentFile.action.toArray();
  print( "The action field contains the following " + a );
  return incidentFile
 }
 else
 {
  print( "Could not find Incident record. " + RCtoString( rc ) );
  return null
 }
}

incidentID = "IM1010";
findIncident( incidentID );