Custom JavaScript tab

Creates a custom JavaScript snippet to use for a custom action.

Figure: Custom JavaScript tab

Custom Javascript File tab

Background and Setup

Examples

Prerequisites

How to Start

  1. Click Settings.

    Settings
  2. Click Work Center.

    Work Center Settings
  3. On the General screen, click the Custom Action tab.

    Click Custom Actions Settings Tab
  4. On the Custom Action screen, in the left pane, expand the Shared Resources tab.

    Expand Shared Resources
  5. On the Shared Resources tab, click JavaScript > Select a JavaScript file.

    Click JavaScript

Fields

Field NameDefinition

JavaScript editor

Description:
Specifies the JavaScript code snippet to use for a custom action.
Allowed Values:
A JavaScript code snippet that can be enclosed within a JavaScript function.
Default Value:
None
Example:
setInterval(function () {
  const date = new Date();
  const hour = date.getHours();
  const minute = date.getMinutes();
  const seconds = date.getSeconds();
  const day = date.getDate();
  const month = date.getMonth() + 1;
  const year = date.getFullYear();
  ev.target.querySelector('#currentDate').innerText = 
    day + '/' + month + '/' + year;
  ev.target.querySelector('#currentTime').innerText = 
    hour + ':' + minute + ':' + seconds;
}, 100);
Limitations:
  • These requirements apply to images used in custom actions.
    • Images must be stored in a web server or cloud storage location accessible through HTTPS that AgilePoint NX can access.
    • Images cannot be stored on a local file system, such as your local machine or the AgilePoint Server machine.
    • Images must be referenced with an absolute URL.

Save Save icon

Function:
Saves the changes to the JavaScript file.

Cut Cut icon

Function:
Cuts the selected code from the file.

Copy Copy icon

Function:
Copies the selected code.

Paste Paste icon

Function:
Inserts the copied data at the specified location.

You can paste from files or other sources outside of AgilePoint NX.

Undo Undo icon

Function:
Removes the last text entered in the file.

Redo Redo icon

Function:
Cancels the last undo action.

Export Export icon

Function:
Downloads the custom JavaScript file embedded in a JSON file to your local machine.

The JSON format is required for users to import into Agilepoint NX.