> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/write-script.md).

# Write Script

## Description

The *write\_script* part allows you to have the system execute a JavaScript/jQuery.

## Use

You can use the write script part in a node to execute JavaScript/jQuery at any point in the application.

NOTE: With the *write\_script* client script part you can have your application execute in the browser JavaScript modeled in a logicnet. You must use this part must be used carefully, however, as it possible to make mistakes and introduce XSS vulnerabilities: <https://owasp.org/www-community/attacks/xss/>.

When you use this part you must make sure that all data inserted into the script using *$(..)* is properly encoded.

* For strings, you should call the JavaScript encode method *myfunction("$(encode\_js(…))")*.
* A JSON-encoded string should not be JavaScript-encoded when used directly in a data object: *var json=$(json\_str)*.
* If you use *JSON.parse*, data must be JavaScript-encoded using *JSON.parse("$(encode\_js(json\_str))")*.

## Editor Fields

| Field Name         | Description/Use                                                                                                                                                                                                                                                                                                                                                                | Type/Options  | Optional/Mandatory |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | ------------------ |
| Javascript         | This is the name of the JavaScript the system should execute.                                                                                                                                                                                                                                                                                                                  | Text          | Mandatory          |
| Mode               | <p><strong>Read</strong>: The system executes the JavaScript in the read cycle of the node.<br><strong>Write</strong>: The system executes the JavaScript in the write cycle of the node.<br><em>Note</em>: Some nodes don't have a write cycle; for example, the process node. So combining the write\_script part in a process node with mode set to 'Write' won't work.</p> | Read \| Write | Mandatory          |
| Skip interpolation | <p><strong>Unchecked</strong>: This means the system will interpolate.<br><strong>Checked</strong>: This means the system will not interpolate.</p>                                                                                                                                                                                                                            | Checkbox      | Mandatory          |
| Escape jQuery      | <p>This is only required when Skip interpolation is unchecked.<br><strong>Unchecked</strong>: The system will not escape the jQuery code, so $() will be seen as an interpolation instead of jQuery.<br><strong>Checked</strong>: The system will escape the jQuery code, so $() will be seen as jQuery instead of as an interpolation.</p>                                    | Checkbox      | Optional           |

## Example

Please download and import the following [example project](/release-9/example-gallery/example-projects-for-parts/write-script-example-project.md) in your workspace.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/write-script.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
