JavaScript method: SCFile.doAction()

This method executes a Document Engine action using any new field values defined in a ITSMA Service Management file object. You must define a Service Management file object and new values for required fields.

Syntax

SCFile_object.doAction( docEngineAction );

Arguments

The following arguments are valid for this method:

Argument Data type Description
docEngineAction String This argument specifies the Document Engine action you want the script to execute on the object. This argument must contain a valid Service Management Document Engine action appropriate for the Service Management object.

Return values

RC_SUCCESS or one of the other global return code values.

The method returns RC_SUCCESS if the method successfully runs the Document Engine action or returns one of the error global return code values if the method cannot run the Document Engine action.

Example

This example does the following:

  • Creates a new incident record from variable values
  • Resolves the incident record

This example requires the following sample data:

  • The "Use Resolved Status?" option enabled in the Incident Management Environment record
  • A valid value for the number field (for example, "IM11112")
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.doInsert();
 if ( rc == RC_SUCCESS )
 {
  print( "Success. Created new record " + newIncident.getText() );
  return newIncident.number
 }
 else
 {
  print( "Could not create record. " + RCtoString( rc ) );
  return null
 }
}

function resolveIncident( id, action, rescode, res )
{
 print( "Resolving incident " + id + "..." );
 var findIncident = new SCFile ( "probsummary" );
 var f = findIncident.doSelect( "number=\"" + id + "\"" );
 if ( f == RC_SUCCESS )
 {
  print( "Success. Found interaction record..." );
  findIncident.resolution_code = rescode;
  findIncident.resolution = res;
  var a = findIncident.doAction( action );
  print( "The resolve Incident return value is " + RCtoString( a ) );
  print( "The incident record is " + findIncident.getText() )
  print( "The value of the status field is: " + findIncident.problem_status );
  return findIncident
 }
 else
 {
  print( "Could not find record. " + RCtoString( f ) );
  return null
 }
}

numberValue = "IM11121"
callbackContact = "ADMINISTRATOR, SYSTEM";
categoryValue = "network";
assignmentValue = "HELPDESK";
descriptionValue = null;
interactionID = insertIncident( numberValue, callbackContact, categoryValue, assignmentValue, descriptionValue );
actionType = "resolve";
resultionCodeValue = "Advice & Guidance";
resolutionValue = null;
resolveIncident( interactionID, actionType, resultionCodeValue, resolutionValue );