v2.1.6+Inline Scripting task JSDL definition

Reference for the JSDL structure, namespace, and XML encoding rules used to define Inline Scripting tasks with the Orchestration CLI.

An Inline Scripting task is defined in JSDL using the http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdljavascript namespace. The JSDL fragment wraps the script body, input JSON, and optional connection and limit parameters in a standard jsdl:jobDefinition container. For the full list of supported parameters and their defaults, see Inline Scripting task parameters and output properties.

JSDL structure

The following annotated fragment shows the complete JSDL structure for an Inline Scripting task:

<?xml version="1.0" encoding="UTF-8"?>
<jsdl:jobDefinition
    xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl"
    xmlns:jsdljavascript="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdljavascript"
    name="TASK_NAME">
  <jsdl:application name="javascript">
    <jsdljavascript:javascript>
      <jsdljavascript:javascriptParameters>

        <!-- Optional: connection for HTTP allowlist/denylist -->
        <jsdljavascript:Connection>
          <jsdljavascript:allowedHosts>host1.example.com,host2.example.com</jsdljavascript:allowedHosts>
          <jsdljavascript:blockedHosts>blocked.example.com</jsdljavascript:blockedHosts>
        </jsdljavascript:Connection>

        <jsdljavascript:Action>
          <jsdljavascript:executeScript>

            <!-- Required: script body -->
            <jsdljavascript:script>script body</jsdljavascript:script>

            <!-- Optional: input JSON object -->
            <jsdljavascript:inputJson>{"key": "value"}</jsdljavascript:inputJson>

            <!-- Optional: execution limits -->
            <jsdljavascript:scriptTimeoutSeconds>60</jsdljavascript:scriptTimeoutSeconds>
            <jsdljavascript:memoryLimitMb>256</jsdljavascript:memoryLimitMb>
            <jsdljavascript:maxConsoleBytes>1048576</jsdljavascript:maxConsoleBytes>
            <jsdljavascript:fetchTimeoutSeconds>30</jsdljavascript:fetchTimeoutSeconds>
            <jsdljavascript:failOnConsoleError>false</jsdljavascript:failOnConsoleError>
            <jsdljavascript:verboseRuntimeLog>false</jsdljavascript:verboseRuntimeLog>

          </jsdljavascript:executeScript>
        </jsdljavascript:Action>

      </jsdljavascript:javascriptParameters>
    </jsdljavascript:javascript>
  </jsdl:application>
</jsdl:jobDefinition>

XML encoding in script bodies

Script content is embedded as XML text inside the <jsdljavascript:script> element. Characters that are special in XML must be escaped before the XML parser passes the text to the runtime:

Character XML form Notes
' (single quote) &apos; Always escape in element text content.
< &lt; Always escape in element text content. Required for comparison operators such as < and <=.
> &gt; Escape recommended. Required for >=.
& &amp; Always escape in element text content.
" (double quote) &quot; or " Escape required only in XML attribute values, not in element text.

JSDL examples

Minimal script (no inputs, no connection)

Returns the number 42. The last-statement value is published as result.result.

<jsdljavascript:executeScript>
  <jsdljavascript:script>42</jsdljavascript:script>
  <jsdljavascript:inputJson></jsdljavascript:inputJson>
</jsdljavascript:executeScript>

Expected output properties: result.result=42.

Reading inputs and returning a value

Reads name from the inputs JSON and returns a greeting string. Single-quote characters in the script body are escaped as &apos; in JSDL.

<jsdljavascript:executeScript>
  <jsdljavascript:script>&apos;Hello, &apos; + inputs.name + &apos;!&apos;</jsdljavascript:script>
  <jsdljavascript:inputJson>{"name":"World"}</jsdljavascript:inputJson>
</jsdljavascript:executeScript>

Expected output properties: result.result=Hello, World!.

Explicit output properties using outputs

Assigns multiple keys to the outputs global. Each key becomes a named output property. When outputs keys are set, the last-statement value is ignored.

<jsdljavascript:executeScript>
  <jsdljavascript:script>
outputs.status = 200;
outputs.message = &apos;ok&apos;;
  </jsdljavascript:script>
  <jsdljavascript:inputJson></jsdljavascript:inputJson>
</jsdljavascript:executeScript>

Expected output properties: result.status=200, result.message=ok.

Outbound HTTP call with allowlist

Calls an external REST endpoint using fetch(). The allowedHosts connection parameter must contain the target domain; otherwise the task fails with a policy-denial error before any network call is made.

<jsdljavascript:Connection>
  <jsdljavascript:allowedHosts>api.example.com</jsdljavascript:allowedHosts>
</jsdljavascript:Connection>
<jsdljavascript:Action>
  <jsdljavascript:executeScript>
    <jsdljavascript:script>
const response = await fetch(&apos;https://api.example.com/data&apos;);
const data = await response.json();
outputs.status = response.status;
outputs.count  = data.total;
    </jsdljavascript:script>
    <jsdljavascript:inputJson></jsdljavascript:inputJson>
  </jsdljavascript:executeScript>
</jsdljavascript:Action>

Expected output properties: result.status=200, result.count=n.

Note: Top-level await is supported without an explicit async wrapper. When the script contains top-level await, the last-statement value is not captured; use outputs to surface results.