Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Dot-walking in scripts

Dot-walking in scripts

You can dot-walk within a script by invoking the dot-walk syntax.

This functionality requires a knowledge of JavaScript.

For scripts that run on the server side, such as business rules, it is necessary to add current.

The following script, for example, is a scripted approval rule that requests an approval from the manager of the user who opened the ticket.
try {
    current. opened_by. manager ; } catch (err ) { }
For scripts that run on the client side, such as client scripts, current is not necessary. For instance, the following Highlight VIP Caller script runs on the client side.
function onChange (control , oldValue , newValue , isLoading ) {
 
     //wait until there is a valid record in the field if (newValue ) {
 
       //get the caller object so we can access fields var caller  = g_form. getReference ( 'caller_id' ) ;
 
       var callerLabel  = document. getElementById ( 'label.incident.caller_id' ) ; var callerField  = document. getElementById ( 'sys_display.incident.caller_id' )
 
       //check for VIP status if (caller. vip == 'true' ) {
 
         //change the caller label to red background //style object is CSSStyleDeclaration, style names are not standard css names if (callerLabel )
           document. getElementById ( 'label.incident.caller_id' ). style. backgroundColor = 'red' ;
 
         //change the caller's name field to red text if (callerField )
           document. getElementById ( 'sys_display.incident.caller_id' ). style. color = 'red' ; } else { //not a VIP, remove temporary styles if (callerLabel )
           document. getElementById ( 'label.incident.caller_id' ). style. backgroundColor = '' ; if (callerField )
           document. getElementById ( 'sys_display.incident.caller_id' ). style. color = '' ; } } }

This site is scheduled for a small content update on Monday, November 19th, between the hours of 3:30pm and 5:00pm Pacific Time (Nov 19 23:30 – Nov 20 1:00 UTC). Acces to this site may be slightly delayed during that time.