Skip to content

Debugging Custom Index Behaviors

A Custom Behavior runs in an isolated engine: QuickJS in the browser, V8 on the server. The engine has no console, no debugger and no network. Each section below starts from what you see, gives the cause, and gives the fix.

Start with the browser developer console (F12, Console tab): the host logs script errors there even though your script cannot. For the objects and limits, see the Reference.

Summary

Symptom Group
Behavior could not be fired Errors in the browser
Could not find localized string Errors in the browser
The script was interrupted Errors in the browser
A validation message never shows, or never clears Wrong result in the browser
The behavior never seems to run Wrong result in the browser
A Boolean or number check never matches Wrong result in the browser
Dates are off by one day Wrong result in the browser
Document failed to invoke behaviors Server runs
Document has no content type Server runs
Different result in the workflow than in the browser Server runs
Start QC Task creates a task anyway Server runs
Lookup could not retrieve data Lookups
A lookup does not find a value the user typed Lookups
The content type does not load in a task's index panel Task layouts

Errors in the browser

Behavior could not be fired

  • Message Behavior Custom Behavior could not be fired.
  • Where Under the field the behavior is attached to. Nothing from the script applies.
  • Cause One of the four causes below.
  • Script error The script threw an error. Common ones: console.log(...), Context.Username, panel["Wrong Name"].RuntimeValue, builder.SetChoices(...), a top-level return.
  • Time limit The script ran longer than 5 seconds.
  • Field name A builder call named a field that does not exist.
  • Control type The field's control type was changed to one that does not allow Custom Behaviors.
  • Fix Open the browser console. A script error shows as an error object with a name (ReferenceError, TypeError, SyntaxError) and a message. Fix what it names.
  • Timeout A timeout shows an InternalError with the message interrupted (see The script was interrupted).
  • Clean console If the console is clean, check every field name in your builder calls, then the field's control type.
  • See Show values while you test

Could not find localized string

  • Message Could not find localized string. under a field
  • Cause The script called SetFieldValidationMessage(field, "") or SetValidationMessage(""). An empty message is looked up as a resource and not found.
  • Fix Never pass an empty message. To remove a message, call SetFieldIsValid(field, true), which clears every message on the field.
  • See Validate Fields with Your Own Messages

The script was interrupted

  • Message interrupted in the console, or Script execution interrupted by host in the server log
  • Cause The run passed 5 seconds. Common causes: a loop that never ends, a regular expression with nested repetition such as (a+)+ on a long value, or two behaviors that set each other's fields without suppressing behaviors.
  • Fix Bound every loop, simplify the pattern, and pass true as the third argument of SetFieldRuntimeValue on one side of a pair.
  • On the server A timeout or error makes Run Indexing Behaviors report the document (see Document failed to invoke behaviors) or fail the step with Error calling invoke Behaviors.

Wrong result in the browser

A validation message never shows, or never clears

  • Cause The order of calls. SetFieldIsValid(field, true) clears messages, so a message set before it in the same run disappears. A happy path that never calls SetFieldIsValid(field, true) leaves the old message.
  • Two scripts Two scripts that validate the same field overwrite each other, because all Custom Behaviors share one valid flag per field.
  • Fix Call SetFieldIsValid(field, ok) first in every run, then SetFieldValidationMessage(field, text) only when not ok. Put all rules for one field in one script.
  • See Reference: validation messages

The behavior never seems to run

  • Cause A behavior runs on panel load and when its own field changes, not when other fields change. A value set by another behavior with suppressBehaviors = true does not run it either.
  • Chain stopped In the console, Skipping behavior <key> on column <field> - previous behavior invalid means an earlier built-in behavior on the same field stopped the chain.
  • Old browser A custom behavior attempted to run but the browser doesn't support them. means the browser has no WebAssembly.
  • Fix If the result depends on another field, attach the script to that field too. Check Change Behavior Order. Use a current browser.

A Boolean or number check never matches

  • Cause RuntimeValue is always a string. A Boolean field reads "true" or "false", never true. A number reads "750". You may also be reading a value you set in the same run: writes apply after the script ends.
  • Fix Compare (v || "").toLowerCase() === "true". Convert numbers with parseFloat after removing $ and ,. For each method and field, only the last call counts.
  • See Reference: value formats

Dates are off by one day

  • Cause A date field holds an ISO 8601 string in UTC, for example "2026-10-07T00:00:00.000Z". Local-time methods such as getDate() shift it in time zones west of UTC.
  • Fix Use getUTCFullYear, getUTCMonth, getUTCDate and getUTCDay.
  • See Date Validation Rules

Server runs

Document failed to invoke behaviors

  • Message Document <id> failed to Invoke Behaviors
  • Where The Run Indexing Behaviors step writes this to the work item's events. In Index Your Documents it is a reason the work item stops for a person.
  • Cause The behaviors for that document failed on the server: a script error, a timeout, or a script that depends on the browser.
  • Fix Open a document of the same content type in the Index app and check the console. Guard browser-only code with if (context.app !== "worker"). The other documents in the work item are still processed.

Document has no content type

  • Message Document does not have a Content Type specified. Unable to Run Behaviors on Document
  • Cause The Run Indexing Behaviors step found a document with no content type. The step fails.
  • Fix Set the content type before the step, for example with Intuitive AI classification or a Custom Step (builder.SetContentType).
  • Start QC Task Skips such documents instead of failing.

Different result in the workflow than in the browser

  • Symptom It works in the browser and gives a different result in the workflow.
  • Cause The server runs (Index Your Documents, Run Indexing Behaviors, Start QC Task, Search bulk edit) have no user. context.username is "", context.usergroups is [] and context.app is "worker".
  • Effects A script that writes the user name writes "". A group check never matches. A date rule uses the day the step runs.
  • Start QC Task Runs behaviors by default (Mark Valid Documents as Indexed = Yes).
  • Fix Decide what the server should conclude, and write it. Wrap user-dependent code in if (context.app !== "worker"). Keep validation rules that must hold on the server outside that check.
  • See Stamp the Approving User and Reference: server runs

Start QC Task creates a task anyway

  • Symptom Start QC Task creates a task although Allow Straight Through Processing is on.
  • Cause The step skips task creation only when every document in the work item is marked as indexed. A document is not marked when any field is invalid after the behaviors run, when no field has a value, or when it has no content type.
  • Side effect On a document that is not marked, the step also discards the values that behaviors changed.
  • Fix Open one of the documents in the Index app and look for invalid fields. Check that Mark Valid Documents as Indexed is Yes: straight-through processing depends on it.
  • Older steps For steps saved on an earlier release, open the step and check both settings.

Lookups

Lookup could not retrieve data

  • Message Could not retrieve data from source.
  • Cause A Filter, Source Lookup, Term Set Lookup or Multi Key Automatic Indexing behavior could not query its source. A Custom Behavior never shows this message. After a failed Filter, the dependent dropdown keeps its old list.
  • Fix Check the source connection, the gateway, the table and the column names in that behavior.
  • Source down To keep users working while a source is down, see Handle a Failed Lookup in a Cascading Dropdown.

A lookup does not find a value the user typed

  • Cause The source can be case-sensitive or store a different form: AB-1001 in the table, ab-1001 typed.
  • Fix Normalize the key with a Custom Behavior placed before the lookup in Change Behavior Order.
  • See Format and Normalize Field Values

Task layouts

The content type does not load in a task's index panel

  • Cause This has been reported for content types with Custom Behaviors in a task layout. The cause is not in the script if the same content type loads elsewhere.
  • Fix Open the same content type in the Index app. If it loads there, report it to support with the content type name and the task layout name.

Show values while you test

Use the Test button in the Custom Behavior editor (Connections app). It runs the script against the preview panel with your user name and context.app set to taxonomy. Remove debug code before you save the final version.

Write to a debug field. Add a Textbox field named Debug to the content type while you test:

Debug: list every field
var lines = [];
lines.push("app=" + context.app);
lines.push("user=" + context.username);
lines.push("groups=" + (context.usergroups || []).join(","));
for (var key in panel) {
    lines.push(key + "=" + JSON.stringify(panel[key].RuntimeValue) + " (" + panel[key].Style + ")");
}
builder.SetFieldRuntimeValue("Debug", lines.join(" | "), true);

This lists the exact field names, which settles most "field not found" problems.

Write to a validation message. Without a debug field, put the text in a message on the attached field. Never pass an empty string.

builder.SetValidationMessage("DEBUG value=" + JSON.stringify(metadataKvp.RuntimeValue));

Throw on purpose. To see a value in the browser console, throw it. Nothing from the script applies in that run.

throw new Error("DEBUG " + JSON.stringify(panel["InvoiceTotal"]));