# Creating a script manually

## Introduction

If you're experienced in creating scripts for your Patchworks process flows and know exactly how to achieve what's needed, you can jump straight in and create scripts from first principles.

{% hint style="info" %}
If you prefer to start with AI assistance, please see [Creating a script with AI](/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/creating-a-script-with-ai.md).
{% endhint %}

## Need to know

* The maximum memory size for a custom script is 512MB
* The maximum size of a custom script is 4GB

## Creating a new script

Follow the steps below:

**Step 1**\
Log in to the [Patchworks dashboard](https://app.wearepatchworks.com/scripts) and select `scripts` from the left-hand navigation bar.

**Step 2**\
Select the `create script` button:

<div align="left"><figure><img src="/files/pyjh4dY9D1HkxTZ5CYD4" alt=""><figcaption></figcaption></figure></div>

**Step 3**\
Add a unique `name` and a `description` and then choose your preferred coding language:

<div align="left"><figure><img src="/files/WcS0VbEj4MCyCRWS2gVP" alt=""><figcaption></figcaption></figure></div>

{% hint style="warning" %}
Script names must be unique - you can't add two scripts with the same name.
{% endhint %}

{% hint style="info" %}
The Patchworks AI panel is displayed below as soon as your coding language is selected in the previous step. Please see [Creating a script with AI](/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/creating-a-script-with-ai.md) for information about these options.
{% endhint %}

**Step 4**\
Click the `create` button:

<div align="left"><figure><img src="/files/wOWjrF8Sw46qGpPvEWf5" alt=""><figcaption></figcaption></figure></div>

The new script is saved, and you're now in edit mode:&#x20;

<div align="left"><figure><img src="/files/oJ9MSjyzTjpINshoEhii" alt=""><figcaption></figcaption></figure></div>

From here, you can [add](#adding-your-code) and [test](/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/testing-scripts.md) your code.

## **Adding & editing script code**

Follow the steps below:

**Step 1**\
Move down to the `code` panel.

**Step 2**\
Add your script code (remember that you can use *IntelliSense* for easy code entry) - for example:

<div align="left"><figure><img src="/files/cR3zV2CcpuOjmQr5a3QE" alt=""><figcaption></figcaption></figure></div>

**Step 3**\
When you're ready to test the script, click the `save and deploy` button:

<div align="left"><figure><img src="/files/GpHjeLIsdRcfuTISwFLb" alt="" width="563"><figcaption></figcaption></figure></div>

This saves and deploys the code so it's ready for [testing](/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/testing-scripts.md).


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/creating-a-script-manually.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
