List: JavaScript examples

The following table lists the JavaScript examples available for review. These examples include sample JavaScript code for the HPE Service Manager-defined JavaScript objects, methods, and properties, as well as code samples that call the system JavaScript functions provided in the Script Library. These JavaScript are intended to work with an out-of-box Service Manager system and sample data.

JavaScript example Service Manager object, method, or property demonstrated System functions called
Example: Getting a list of logged on users
  • system.users (global property)
  • print(); (global method)
  • getName(); (method of the XML object)
  • getValue(); (method of the XML object)
None
Example: Iterating through a complex XML document
  • XML(); (XML object)
  • setContent(); (method of the XML object)
  • getDocumentElement(); (method of the XML object)
  • getQualifiedName(); (method of the XML object)
  • getFirstAttribute(); (method of the XML object)
  • getFirstChildElement(); (method of the XML object)
  • getNextSiblingElement(); (method of the XML object)
None
Example: Query a record using the SCFile object
  • SCFile(); (SCFile object)
  • doSelect(); (method of the SCFile object)
  • RCtoString(); (method of the SCFile object)
  • getFirstChildElement(); (method of the XML object)
  • getName(); (method of the XML object)
  • getValue(); (method of the XML object)
None
Example: Testing a file name
  • SCFile(); (SCFile object)
  • doSelect(); (method of the SCFile object)
  • print(); (global method)
None
Example: Updating a field with the current date and time
  • SCFile(); (SCFile object)
  • doSelect(); (method of the SCFile object)
  • print(); (global method)
  • system.functions (global property)
  • Date(); (Date object)
  • SCDatum(); (SCDatum object)
  • getType(); (method of the SCDatum object)
  • doUpdate(); (method of the SCDatum object)
  • RCtoString(); (method of the SCDatum object)
None