Userscripts
6 min read
last updated: 08/19/2026
Execute your own javascript scripts on the currently opened ReqIF document. Mass update attributes conditionally or based on other attributes.
TLDR; Jump to example script
Javascript automation

Notices and limitations
- The Javascript execution could produce unexpected results due to the fragile nature of Javascript engine
- Read only attributes cannot be updated
- If a value is invalid the attribute value will be empty
- HTML special characters will be converted to UNICODE so that will be \u00A0, in regex replace use UNICODE character codes
- The javascript engine in ReqEdit is a basic javascript interpreter and does not have browser capabilities
- Updating a multi-object-type document can update all attributes values. Use the ReqEdit.ObjectType to limit what object type attributes to set
Script execution
The User scripts selector displays all the scripts found in ReqEdit scripts folder located at the current user’s %localappdata%\REQTEAM\ReqEdit\UserScripts\ folder.
From the editor window it is possible to quickly IMPORT and EXPORT these scripts. 
The script selector is located at the right side of the toolbar

Select a script and then press
to execute on all rows or
to execute on only the selected row.
Run on document
will be executed on each line from top to bottom according to the order in the hierarchy of the document.
Each row will have an index number represented by global.index variable (read on to find out more)
On each row you will be able to read all the columns and change them.
To save the changes to the current row use save(row)
Attribute type usage
| Type | Information |
|---|---|
| Boolean | use only the values: true, false without quotation marks |
| String | update the value as “text in quotation marks” |
| Integer | update with number |
| Date | update with a formatted string “yyyy-mm-ddThh-mm-ss“ |
| Enumeration single value | specify the “value” case sensitive or “” to remove |
| Enumeration multi value | specify as a “comma,separated” string case sensitive or “” |
| XHTML | update the value as “<strong>html codes</strong>” |
Javascript
Supports all ECMAScript 3 and ECMAScript 5 functionality, including ES5 strict mode
Read more about the supported Javascript features here Jurassic library
Variables
| row | read/write | holds all attributes of the current row row[“ID”] – read-only UUID row[“ReqIF.ChapterName”] is the value row[“ReqIF.ChapterName.type”] is the attribute type row[“ReqIF.ChapterName.status”] is New, Edited, EditedAndSaved, Unchanged, Deleted, SoftDeleted |
| links | read | array of link items link[“type”] can be inlink, outlink, external link[“source”], link[“target”] row item of the linked object link[“uri”], link[“description”] external link metadata link[“groupName”] for in/out links |
| hasChildren | read | true/false if the row has children or not |
| childCount | read | number of child rows |
| global | read | metadata of the current row or to be used to pass values between rows |
| global.index | read | the number of the row in the selected rows starting from 1 |
| global.level | read | the level of the row starting from 1 |
| global.status | read | the status of the field: New, Edited, EditedAndSaved, Unchanged, Deleted, SoftDeleted |
| global.rows | read | the total count of rows in the current selection, can be used to print log message only on the last row ex: global.rows == global.index |
Functions
| log(string variable) | display the contents of a single string variable to the output |
| save(row) | IMPORTANT use this as the last line to save the row |
| show_form(formdata) | display an automatically generated dialog form, the returned data can be used to change script execution. Read more on the dynamic forms section |
log(variable) calls will be collected and displayed at the end to the user. If the script editor is open the output messages are displayed in the bottom part of the editor

Dynamic forms
JSON defined dynamic dialog forms can be displayed from javascript.
var values = show_form({
"title": "Table splitter",
"fields": [
{ "name": "header_rows", "label": "Header rows", "type": "number", "min": "1", "required": true },
{ "name": "table_properties", "label": "Properties", "type": "text", "default": " width=\"100%\" border=1 " }
]
});
save(row);
Schema: title, description, fields[], submitLabel (alias: submitlabel), cancelButton (alias: cancelbutton).
Field types: number (int), string, text, boolean, options (string[]), label (plain text), html (rendered HTML preview).
Field properties
| Property | Applies to | Description |
|---|---|---|
name | input fields | Key in the returned object (required for submittable fields) |
label | all | Caption; for label type, full-width descriptive text only |
type | all | See field types above |
min, max | number | Inclusive bounds (strings, parsed as integers) |
required | input fields | Empty string/text/options fail validation when set |
default | input fields, html | Initial/submitted value for inputs; HTML body or document for html fields |
options | options | String array of dropdown choices |
Fields without name, or with type label / html, are display-only and omitted from the return object.
HTML fields
Read-only HTML preview inside the dialog (type: "html"). Use for reports, formatted help text, or attribute previews — not for collecting user input.
ReqEdit uses System.Windows.Forms.WebBrowser (470×600). Field default supplies content. Save button exports to PDF or .html (Aspose.Words).
Rendering engine
The WinForms WebBrowser control hosts the legacy MSHTML (Trident / Internet Explorer) engine — not Edge, Chromium, or WebView2.
| Aspect | Behaviour |
|---|---|
| Engine | MSHTML / Trident (same family as ReqEdit XHTML grid cells) |
| Document mode | IE7 by default — ReqEdit does not set FEATURE_BROWSER_EMULATION; an admin may override per-exe in the registry |
| Load method | DocumentText — in-memory HTML string, not a browsed URL |
| Navigation | Disabled (AllowNavigation = false) — links do not open |
| Scripts | Not supported for forms; errors suppressed (ScriptErrorsSuppressed = true) |
Preview therefore matches classic ReqIF/XHTML markup in the desktop app, not modern browser behaviour.
Supported HTML (practical)
| Works well | Avoid / unreliable |
|---|---|
div, p, span, br | HTML5-only tags (section, article, …) |
b / strong, i / em, u, sub, sup | Flexbox, grid, CSS variables |
table, tr, td, th, thead, tbody | External CSS/JS from CDN or http(s) URLs |
ul, ol, li | ES6+ JavaScript, modules, fetch |
Inline style="..." on elements | SVG/canvas-heavy layouts |
<object> attachments (ReqIF pattern) | form, iframe, input, select, textarea |
Simple <html><head><title>…</title><body>…</body></html> | @media queries, web fonts (may not load) |
Content rules for default:
- Empty / missing → blank page (
<html><body></body></html>). - Fragment without
<html>→ wrapped as<html><body>…</body></html>. - Full document containing
<html>→ loaded as-is.
name is optional; if present, the field is still not submitted. required has no effect.
Default values
Resolution order in ReqEdit dialogs:
- Field
defaultin the form definition. - Type fallback when no default is set.
| Type | Fallback when no default |
|---|---|
number | min if set, otherwise 0 |
boolean | false |
options | first entry in options |
string, text | "" |
Use JSON booleans for checkbox defaults — default: true / default: false (not "true" strings).
Boolean single-choice pattern — model “pick exactly one” with multiple boolean fields. Set default: true on the first option; validate in script that exactly one checkbox is true:
function buildSingleChoiceFields(fieldPrefix, groupLabel, options) {
var fields = [{ type: "label", label: groupLabel + " (select exactly one)" }];
for (var i = 0; i < options.length; i++) {
fields.push({
name: fieldPrefix + "_" + i,
label: options[i],
type: "boolean",
default: i === 0
});
}
return fields;
}
ReqEdit dialog behaviour: WinForms dialog; field default pre-fills controls. Cancel returns {}.
Return value
Plain object keyed by field name. Types match field types (number → int, boolean → bool, others → string).
Example script
- Create a document by selecting File > New > New Archive …
- Select ReqEdit JS Demo template and save the file (the name is not important)
- Select the ReqEdit JS Demo script
(If by any means the ReqEdit JS Demo script is not available create it manually, jump to create scripts and use the example script from below) - Press
Run on document - Observe the change of the ReqIF-WF.CustomerStatus value to Accepted

- Read more in the the ReqIF Info panel

The script
Change a value conditioned by another value
if(row["ReqIF-WF.Type"] == "Requirement"){
row["ReqIF-WF.CustomerStatus"] = "Accepted"
}
save(row);
Explanation
1.Using the if(<logical condition>){ … } control statement
2.Test the <logical condition> where ReqIF-WF.Type column value is equal to Requirement
3.If the logical condition is true then execute the code betwen { … }
4.Change the value of ReqIF-WF.CustomerStatus value to Accepted
5.Save the changes for the current row by calling save(row)
Without save(row) the changes are not applied to the document
Creating or modifying scripts
You can create new scripts by selecting empty on the script selector then pressing the edit button

Save the script with a descriptive name

The script will then be displayed in the dropdown automatically to be executed easily
