Skip to content

Editor

Content Script objects can be edited with the dedicated web-based IDE selecting the 'Editor' function in the object function menu. The function is also available as a promoted function.

The web-based IDE (Integrated Development Environment) for Content Script appears as follows:

Content Script editor

Coming from Module Suite < 4.1?

The editor has been reorganized, but the familiar features are still available:

  • Undo and Redo are now keyboard shortcuts only (Ctrl + Z and Ctrl + Y).
  • To change the script's icon, click its icon beside the script name on the left of the top bar.
  • Static variables now open in their own tab from the database icon beside a script in the Scripts panel. Saving that tab updates the variables without creating a script version.
  • Theme, AI completion, and Idle prediction have moved under the editor settings (gear icon).
  • The former validation indicator and real-time validation switch are combined in the Valid / Invalid status chip.
  • The master log and Distributed Agent logs are available from the Logs panel. Rotation and download actions are in each open log tab.
  • Versions now opens an in-editor version list and comparison view, with a link to the classic Content Server versions page.
  • The execution buttons are combined into the Execute split button. Its menu switches between running inside the editor and running in a separate tab.
  • Scheduling and impersonation are available from the labeled Schedule and Impersonation controls.

The redesigned editor also adds workspaces, multiple open scripts, workspace-wide search, live log tabs, and the Carl assistant. These features are described in the sections below.

Shortcuts

The following keyboard shortcuts are available while using the editor:

Shortcut Description
Ctrl + S Save the current script and add a new version
Ctrl + Z Undo the last change
Ctrl + Y Redo the last undone change
Ctrl + J Run the script the way the run button is set to
Ctrl + Space Show the code autocompletion hints
Ctrl + H Show or hide the help panel
Ctrl + F Open the search and replace panel
Ctrl + Shift + F Search across the scripts of the open workspace
Ctrl + P Insert the path of a node chosen into the browser
Ctrl + L Send the selected lines to Carl as a reference

Top Bar controls

Editor top bar

The top bar uses labeled actions rather than icon-only buttons. Two icon-only controls remain on the far right:

  • The gear opens Editor settings (theme and AI completion options).
  • The left arrow leaves the editor and opens the Content Server folder that hosts the script currently being edited.
Control Description
Save Saves the current buffer. Saving a Content Script adds a new version. Saving static variables updates the object's compiled variables without creating a version.
Execute Saves the script and runs it. The button itself runs in the selected mode; the chevron switches between Execute (result in a frame inside the editor) and Run in separate tab (Content Server opens a tab of its own). Ctrl + J uses whichever mode is currently selected.
Versions Opens the in-editor versions dialog. A marker appears on the button when a newer version was saved after this buffer was opened.
Co-edit Starts or joins a live co-editing session for the current buffer. Peers share the text over a room they agree on; nothing is stored on Content Server until someone saves.
Schedule Opens the scheduling dialog for the current script. Shown when the user is allowed to manage schedules.
Impersonation Chooses (or clears) the user this script always runs as. Shown when the user has impersonation privileges.
Sandbox Allows this script to call APIs that the scripting sandbox normally blocks. Enable it only when the script is trusted. The setting is saved on the node as soon as it is toggled.
Valid / Invalid Live validation status of the current buffer. Click the chip to list issues (and jump to their lines) and to turn real-time validation on or off for this script.

Administrator controls

Schedule, Impersonation, Sandbox, and the Logs navigator tab are shown only when the current user has the corresponding privileges.

The left side of the top bar identifies the active document: the object's icon and name, and a subtitle such as Content Script, Static variables, Unsaved changes, or Log file.

Editor settings

Editor settings

The gear on the right of the top bar opens preferences that apply to this editor, not to the script node:

  • Theme: Light, Dark, or High contrast.
  • AI completion: when C.A.R.L. is configured, adds AI suggestions to the completion list next to the rule-based ones when you press Ctrl + Space. Off by default.
  • Idle prediction: independently, asks Carl for a suggestion after a short pause once the current line holds at least three characters. Off by default.

The left-hand navigator switches between three tabs: Snippets, Scripts, and Logs.

Scripts and workspaces

Scripts panel

A workspace is a set of Content Scripts you curate yourself, regardless of where they live in Content Server. Use Browse for scripts to add a script or a whole folder, Workspace to create another workspace, and Export to download the current workspace as a .json file (drop a previously exported file onto the panel to import it).

Each entry opens the script in the working area. Clicking on the hamburger icon next to it opens a dropdown menu with the options to:

  • Open the script's static variables in a second tab.
  • Open the script's parent folder in a new browser tab.
  • Delete the script from the workspace without deleting the object.

Open script tabs

Several scripts, variables buffers, and log views can stay open at once. Unsaved buffers show a marker on their tab. Closing a tab discards that buffer from the editor; it does not delete the object.

Ctrl + Shift + F (or the search icon on the Scripts panel) searches across the scripts of the open workspace. Disabling Search the whole workspace causes the search to be limited to currently opened buffers only.

Workspace search

Logs

Logs panel

The Logs tab lists file appenders (the Module Suite master log and, when present, Distributed Agent logs). Opening a source creates a log tab in the working area. Its toolbar lets you refresh the output, choose how many trailing lines to load, enable Follow to keep up with new output, rotate the current log with Clear, or download the log file. Log tabs, of course, cannot be saved, scheduled or co-edited.

The footer sets the log level of the script currently in context and links to the manage logs page in the admin section.

Snippets

The Snippets tab is a library of ready-to-use code templates, grouped by family (Getting Started, Cache, Callbacks, and so on). Filter the list, then click a snippet to configure it in the helper panel on the right before inserting it at the cursor.

  1. Place the cursor where the code should go.
  2. Select a snippet in the navigator.
  3. Fill in any configuration fields (for example the target container of a “create document” snippet).
  4. Click Insert snippet. The generated code is placed at the cursor and can be edited further.

Helper panel

The right-hand helper panel has three tabs: Snippet, Help, and Carl. Hide or show it with Ctrl + H, or with Help (Ctrl-H) above the working area.

Help

API reference

The Help tab is the Content Script API reference. Browse services and objects, or search by name. Selecting an identifier in the editor and choosing Search in Docs from the context menu fills the same search. Keyboard shortcuts are listed at the bottom of the panel, together with a Content Script Module Help link to this guide.

Carl

Carl assistant

When C.A.R.L. is configured and enabled, the Carl tab is an AI assistant for the script in front of you. Ask a question, describe a change in plain language, or pick a suggested prompt. Carl can explain the current script, edit it, and lint the result. Proposed edits are shown as a diff: Accept & keep applies them to the buffer, Review changes opens the comparison view, and Discard throws them away. Nothing is published to Content Server until you accept the changes.

Select lines in the editor and press Ctrl + L (or Add to Chat in the context menu) to send them to Carl as a reference. Each open script keeps its own conversation. Not to overlap with the application builder purpose, each conversation can only edit the script it is opened for, but can receive context from different scripts (or even logs) thanks to the "add to chat" feature.

Note

Carl and the AI completion options require the C.A.R.L. integration to be configured and enabled. See the LLM / C.A.R.L. documentation for setup. Carl is an experimental feature.

Auto-completion

While typing, press Ctrl + Space to open the completion list. Hints come from the Content Script API catalog and, when enabled, from Carl.

API autocompletion

To suggest members after a dot, the editor must know the type of the expression before it. If that type cannot be inferred (for example, in result. when the origin of result does not reveal its type) the completion list shows Complete as choices. Select the appropriate type and the editor reopens the list with the members available on that type.

With AI completion enabled, generated suggestions appear in their own AI suggestions group above the API matches:

AI autocompletion

Tip: Carl cannot read your mind, leaving a comment hinting at what you plan for the next block of code improves results drastically

Code validation

Every change is checked for formal correctness while real-time validation is on. The status chip on the top bar reports the result (Valid, Invalid, Validating…, or Off). Code that fails validation will most likely fail to compile if it is executed.

Click the chip to inspect issues and to disable real-time validation for long scripts, where validating on every keystroke is too expensive. The choice is remembered per script.

Code validation

Versions

Content Script objects are versioned on Content Server like any other document-class object. Save on a script buffer creates a new version.

Versions opens an in-editor dialog listing each stored version, its author, timestamp, and size. Compare opens that version beside the current buffer in place of the editor. From the comparison you can use Roll back to this version (the older version becomes the buffer, to be saved as the new latest version) or close the comparison and keep editing. Open the Content Server versions page still reaches the classic versions tab.

Versions dialog

If two or more people work on the same script concurrently, there might be cases where saving risks overlapping a colleague's changes. For cases like this a check is now automatically run before every save and it forces a git-like merge conflict resolution in the versions dialog whenever needed. Rollbacking to a previous version when a conflict is detected is treated as an acknowledgement and intentional override of the changes, thus will unlock saving and allow to override the conflicts completely.

Scheduling

Schedule opens a dialog that belongs to the script, not to the editor: schedules keep firing after the editor is closed, and stop only when they are explicitly removed (from here, from the admin page or via distagent api), when they are disabled or when they fail and their "if error occurs" setting is "STOP".

Manage scheduling

Give the schedule an arbitrary Schedule ID (used for unique identification of the scheduling instance), a cron expression (or build one with Cron wizard), and options such as what to do if an error occurs and whether the job is chained. Existing schedules can be viewed, edited, enabled, or deleted from the table at the bottom. You need to explicitly Save before exiting the dialog only when you change the enabled state of one or more schedules.

Scheduling uses Content Server’s Distributed Agent framework. A scheduled run may execute on any server where Distributed Agents are active, not necessarily on the front-end that opened the editor.

For the same capability outside the IDE, see Scheduling a Content Script.

Impersonation

Impersonation on the top bar selects the user this script always runs as, whether it is started by a person, the scheduler, a workflow step, or a callback. Choose user picks a member; Clear removes the setting. The selected name stays visible on the button so an active impersonation is hard to miss.

The user performing the configuration must have impersonation privileges. See Running a Content Script as a different user.

Context menu

Right-click in the working area for editor actions: Cut, Copy, Paste, Select All, and Format Code. When the selection (or the identifier under the cursor) resolves to a Content Script, Open loads that script in a new tab. Search in Docs looks the selection up in the Help panel. With Carl enabled, Add to Chat (Ctrl + L) attaches the selected lines as a chat reference.

Editor context menu