JavaScript method: SCDatum.setValue()

This method updates an HPE Service Manager record with the new field value defined in the newValue argument. This method does not use the Service Manager global return codes.

Syntax

SCDatum_object.setValue( newValue );

Arguments

The following arguments are valid for this method:

Argument Data type Description
newValue String This argument specifies the new value you want the Service Manager object to have. You must use the slash character to escape out quotation marks and any special characters restricted from JavaScript.

Return values

None

Example

This example does the following:

  • Searches the probsummary table for any incident record you define in the search variable
  • Displays the current value of the action field
  • Sets the value of the action field to any value you define in the input variable

This example requires the following sample data:

  • A valid incident record with a value in the action field (for example, "IM1010")
  • A valid action field value update (for example, set the action field to "New description")
var incidentID;
var newValue;

function findIncident( id, value )
{
 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 " + id );
  print( "Displaying the contents of the action field as an object: " + incidentFile.action );
  print( "Setting the value of the action field..." );
  incidentFile.action.setValue( value );
  print( "Displaying the contents of the action field as an object: " + incidentFile.action );
  print( "Displaying the Incident record: " + incidentFile );
  return incidentFile
 }
 else
 {
  print( "Could not find Incident record. " + RCtoString( rc ) );
  return null
 }
}

incidentID = "IM1010";
newValue = "New description";
findIncident( incidentID, newValue );