Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
Example: Updating a field with the current date and time
This JavaScript example demonstrates how to update a field with the current date and time. The script takes a file object (such as system.vars.$L_file or an SCFile object) and a string containing the name of a datetime field in that file, and updates the indicated field with the current date and time.
This script illustrates several key concepts of using JavaScript in HPE Service Manager.
- How to call the RAD filename function from JavaScript.
- How to access a field in a record using an expression of the form file[
fieldName
] wherefieldName
is a string. - How to test the field’s data type.
- How to return JavaScript date objects when you reference Service Manager datetime fields.
- How to assign JavaScript date objects to Service Manager datetime fields.
- How to use SCFile method return codes to test against global properties like RC_SUCCESS.
- How to obtain a localized error message from a return code value using the RCtoString method.
- How to pass traditional query strings that are in Service Manager syntax directly to the doSelect method.
- How to use underscores in JavaScript to reference Service Manager field names containing dots (such as contact.name).
This script demonstrates calling the datetimestamp function. It selects a record from the contacts table and updates the sysmodtime field.
var f = new SCFile( "contacts" ); f.doSelect( "contact.name = \"BROWN, NICHOLAS\"" ); print( "sysmodtime was: " + f.sysmodtime ); datetimestamp( f, "sysmodtime" ); print( "sysmodtime is now: " + f.sysmodtime );
This script demonstrates how passing the wrong kind of field to the datetimestamp function generates an error message.
datetimestamp( f, "contact_name" ); function datetimestamp( file, fieldName ) { var fileName; var today; var fieldType; var rc; fileName = system.functions.filename( file ); today = new Date(); print( "datetimestamp called for file " + fileName + " and field " + fieldName ); var d = new SCDatum( file[fieldName] ); fieldType = d.getType(); if ( fieldType != "TIME" ) { print( "Error! Field " + fieldName + " is a " + fieldType + " field! This function can only be called with date/time fields!" ); return false; } file[fieldName] = today; // Timestamp the field rc = file.doUpdate(); if ( rc != RC_SUCCESS ) { print( "Error " + RCtoString(rc) + " trying to update " + fileName + " record" ); return false; } return true; }
We welcome your comments!
To open the configured email client on this computer, open an email window.
Otherwise, copy the information below to a web mail client, and send this email to ovdoc-ITSM@hp.com.
Help Topic ID:
Product:
Topic Title:
Feedback: