JavaScript method: SCFile.getMessages()

Returns an array of messages generated by the Document Engine from a previous SCFile.doAction().

Syntax

SCFile_object.getMessages();

Arguments

There are no arguments allowed for this method.

Return values

Returns an array of messages from previous SCFile.doAction() call.

Example

This example does the following:

  • Uses the Document Engine add to create a new incident record from variable values.
  • Shows a validation failed due to invalid assignment group.
  • SCFile.doAction() returns 71, "validation failure".
  • SCFile.getMessages() returns messages generated from the Document Engine.
var numberValue;
var callbackContact;
var categoryValue;
var assignmentValue;
var descriptionValue;
var actionType;
var resultionCodeValue;
var resolutionValue;

function insertIncident( num, name, cat, group, desc )
{
 print( "Creating new incident record..." );
 var newIncident = new SCFile( "probsummary" );
 newIncident.number = num;
 newIncident.callback_contact = name;
 newIncident.category = cat;
 newIncident.assignment = group;
 newIncident.description = desc;
 var rc = newIncident.doAction('add');
 if ( rc == RC_SUCCESS )
 {
  print( "Success. Created new record " + newIncident.getText() );
  return newIncident.number
 }
 else
 {
  print( "Could not create record. " + RCtoString( rc ) );
  print( "Reason: "+ newIncident.getMessages() );
  return null
 }
}

numberValue = "IM11121"
callbackContact = "ADMINISTRATOR, SYSTEM";
categoryValue = "network";
assignmentValue = "HELPDESK";
descriptionValue = null;
interactionID = insertIncident( numberValue, callbackContact, categoryValue, assignmentValue, descriptionValue );

Output
	 Category specified is invalid. Reason: Category specified is invalid. Could not create record. Validation failed creating new incident record...