Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Syntax editor keyboard shortcuts and actions

The syntax editor offers keyboard shortcuts and actions to assist in writing code.

Keyboard shortcut or actionDescriptionExample
Write code
Scripting assistance Control+Spacebar

Displays a list of valid elements at the insertion point such as:

  • Class names
  • Function names
  • Object names
  • Variable names

Double-click an entry to add it to the script.

Note: The elements are based on server or client type of script. However, these elements are available based on the UI type you select. For example, spUtil is available for Service Portal client scripts and g_navigation is available for Desktop scripts.

Image omitted: ScriptingAssistanceSuggestions.png
A line of code for a variable definition with a pop-up window displaying potential scripting elements.
Enter a period character after a valid class name.Displays a list methods for the class. Double-click an entry to add it to the script.
Image omitted: ScriptingAssistanceMatchingSuggestionsMethods.png
A line of code for a variable definition with a pop-up window displaying potential scripting elements.
Enter an open parenthesis character after a valid class, function, or method name.Displays the expected parameters for the class or method. Enter the expected parameters as needed.
Image omitted: ScriptingAssistanceParameters.png
A line of code for a variable defining a method call. There is a pop-up window displaying potential scripting elements.
Toggle full screen mode Control+MSwitches between displaying the form with the full screen and displaying it normally. 
Format code - Windows: Control+Shift+B - Mac: Command+Shift+BFormats the selected lines to improve readability.
Image omitted: ScriptingAssistanceUnformattedCode.png
Several lines of unformatted code\[Omitted image "ScriptingAssistanceFormattedCode.png"\] Alt text: Several lines of code formatted for readability
Toggle comment - Windows: Control+/ - Mac: Command+/Adds or removes the comment characters `//` from the selected lines.
Image omitted: ScriptingAssistanceUncommentedCode.png
A line of code selected with no comment characters\[Omitted image "ScriptingAssistanceCommentedCode.png"\] Alt text: A line of code selected with comment characters added to the front of the line.

Insert macro text

  1. In the Script field, type the macro keyword text. For example help.
  2. Press Tab.
Inserts macro text at the current position.
Image omitted: ScriptingAssistanceMacroTyped.png
A line of code containing the string help.\[Omitted image "ScriptingAssistanceMacroAdded.png"\] Alt text: The macro text for help added to the script.
Search
Start search - Windows: Control+F - Mac: Command+FHighlights all occurrences of a search term in the script field and locates the first occurrence. You can create regular expressions by enclosing the search terms between slash characters . For example, the search term `/a{3}/` locates the string `aaa` .
Image omitted: ScriptingAssistanceSearchTerm.png
A search field with the term gr.\[Omitted image "ScriptingAssistanceSearchResults.png"\] Alt text: The search results of the search term gr displaying four highlighted items. The first search result is selected.
Find next - Windows: Control+G - Mac: Command+GLocates the next occurrence of the current search term in the script field. Use Start Searching to change the current search term.
Image omitted: ScriptingAssistanceFindNext.png
The search results of the search term gr displaying four highlighted items. The second search result is selected.
Find previous- Windows: Control+Shift+G - Mac: Command+Shift+GLocates the previous occurrence of the current search term in the script field. Use Start Searching to change the current search term.
Image omitted: ScriptingAssistanceSearchResults.png
The search results of the search term gr displaying four highlighted items. The first search result is selected.
Replace - Windows: Control+E - Mac: Command+EReplaces the next occurrence of a text string in the script field.
Image omitted: ScriptingAssistanceReplaceSearchTerm.png
A replace field with the string gr.\[Omitted image "ScriptingAssistanceReplaceWith.png"\] Alt text: A replace with field with the string gl.\[Omitted image "ScriptingAssistanceReplaceConfirm.png"\] Alt text: A replace confirmation dialog with options for Yes, No, and Stop
Replace all - Windows: Control+; - Mac: Command+;Replaces all occurrences of a text string in the script field.
Image omitted: ScriptingAssistanceReplaceAllSearchTerm.png
A replace field with the search term gr.\[Omitted image "ScriptingAssistanceReplaceAllWith.png"\] Alt text: A replace with field with the string gl.
Help
Help - Windows: Control+H - Mac: Command+HDisplays the list of syntax editor keyboard shortcuts.
Image omitted: SyntaxEditorHelp.png
A pop-up window displaying the keyboard shortcuts for the Syntax Editor.
Show description - Windows: Control+J - Mac: Command+JDisplays API documentation for the scripting element at the cursor's current location.
Image omitted: ScriptingAssistanceAPIdoc.png
A line of code selected with a pop-up window displaying API help for the GlideRecord object

Show macros

  1. In the Script field, type help.
  2. Press Tab.
Displays the list of available syntax editor macros as text within the script field.
Image omitted: ScriptingAssistanceMacroTyped.png
A line of code containing the string help.\[Omitted image "ScriptingAssistanceMacroAdded.png"\] Alt text: The macro text for help added to the script.

Parent Topic:Using the JavaScript syntax editor