Feedback

  • Contents
 

IS_Action_Trace

Definition

IS_Action_Trace writes an entry to the trace log, to aid in script debugging. This action adds custom trace messages from a custom script loaded in Scripter to Scripter's trace log file. The message is traced under the topic "Scripter Custom". Use this action when you need to troubleshoot an issue with a script or to compare the execution of the custom code in the script in relation to how Scripter executes the page that is loaded. The ability to trace is valuable when designing scripts for Scripter and should be taken into account for all scripts, whether they are inbound or outbound.

The first parameter is a string that contains the trace message. The second parameter is optional. It sets the tracing level and must be a value in the range (0-3). Trace messages generated by this mechanism have their own trace topic, "Scripter Custom".

Scripter will recognize click events from any HTML element whose name has an associated action documented in this API (e.g.: "IS_Action_CallComplete"). If the script needs to associate several buttons with the same action, then define the action using a meta element and call the click event on the meta element from the button(s).

Attributes

The IS_Action_Trace element supports the following attributes:

message

Message is the trace message and is a string.

level

Level is the tracing level and must be one of the following:

0

Error

1

Warning

2

Status

3

Notes

If Level is invalid or missing, "Status" is used by default.

[callback]

The callback property ensures that this action executes asynchronously in Interaction Connect. Starting with 2018 R3, all Interaction Scripter actions (IS_Actions) provide a callback property for use in Connect scripts only. In the example below, statements inside the highlighted callback function block execute only after the action completes. The callback will return an error if the action fails. See Writing custom scripts for Interaction Connect or Scripter .NET.

Here's how to use the .callback property in a script for Interaction Connect:

function IS_Action_Trace() {
  IS_Action_Trace.message = "Hello, World!.";
  IS_Action_Trace.level = "3";
  IS_Action_Trace.callback = function(error) {     if (error) {       console.error("IS_Action_Trace failed.");     } else {       console.log("IS_Action_Trace succeeded.");     }   } }

Example 1

<body>
    <input type=button name="IS_Action_Trace" Message="This is a test." Value="Trace">
</body>
<head>
    <meta name="IS_Action_Trace">
    <script language="javascript">
        function Trace(); {
            IS_Action_Trace.message = "This is a test.";
            IS_Action_Trace.level = "3";
            IS_Action_Trace.click();
        }
    </script>
</head>
<body>     <input type=button onclick="Trace();" value="Trace"> </body>

Example 2

<head>
    <meta name="IS_Action_Trace">
    <script language="javascript">
        function IS_TraceNote(p_Message) {
            IS_Action_Trace.message = p_Message;
            IS_Action_Trace.level = 3; // 3= Notes level
            IS_Action_Trace.click();
        }
        function IS_TraceError(p_Message) {
            IS_Action_Trace.message = p_Message;
            IS_Action_Trace.level = 0; // 0= Error level
            IS_Action_Trace.click();
        }
    </script>
</head>
<body>     <input type=button value="Trace Error Message" onclick="IS_TraceError('An Error Occurred');">     <input type=button value="Trace Status Message" onclick="IS_TraceNote('A sale occurred');"> </body>