JavaScript method: SCFile.doInsert()

This method creates a Service Manager record with any new field values defined in a file object. You must define a Service Manager file object and new values for the fields.

Syntax

SCFile_object.doInsert();

Arguments

There are no arguments for this method.

Return values

RC_SUCCESS or one of the other global return code values.

The method returns RC_SUCCESS if the method successfully creates a record or returns one of the error global return code values if the method cannot create the record.

Example

This example does the following:

  • Searches the probsummary table for any incident record you define in the search variable
  • Displays the new incident record as a text string

This example requires the following sample data:

  • A valid value for the number field (for example, "IM11111")
  • A valid value for the callback.contact field (for example, "ADMINISTRATOR, SYSTEM")
  • A valid value for the category field (for example, "network")
var numberValue;
var callbackContact;
var categoryValue;
var descriptionValue;

function insertContact( num, name, cat )
{
 print( "Creating new interaction record..." );
 var newInteraction = new SCFile( "probsummary" );
 newInteraction.number = num;
 newInteraction.callback_contact = name;
 newInteraction.category = cat;
 var rc = newInteraction.doInsert();
 if ( rc == RC_SUCCESS )
 {
  print( "Success. Created new record " + newInteraction.getText() );
  return newInteraction
 }
 else
 {
  print( "Could not create record. " + RCtoString( rc ) );
  return null
 }
}

numberValue = "IM11112"
callbackContact = "ADMINISTRATOR, SYSTEM";
categoryValue = "network";
insertContact( numberValue, callbackContact, categoryValue, descriptionValue );