Creating a script manually
Introduction
If you're experienced in creating scripts for Patchworks and know exactly how to achieve what's needed, you can jump straight into the code. With the build & test page in manual mode, you have a full code editor with an integrated test panel alongside:

The build & test page
The key elements of this page are summarised below:
Manual / AI toggle
Switch between writing code yourself and building with AI. You can move between the two freely — for example, generate a draft with AI, then fine-tune it by hand.
Version menu
Choose which version of the script you're working on, or start a new version. The counter alongside shows how many of the available 10 versions are used.
Code editor
A full code editor with syntax highlighting and line numbers. The status bar shows the language and version you're editing, together with your cursor position.
Test inputs / Logs
The integrated test panel — see Testing scripts.
Save / Save & continue
Save the current version. Saving does NOT deploy the script — see Deploying scripts & managing versions.
Settings
Open the script's settings to update basic details (such as the runtime version).
Full screen
Expand the editor to fill your browser window — see below.
Adding & editing script code
When your script is first created, the editor is pre-loaded with a starter template for your chosen script type and language. The template documents the inputs your script receives and the output it's expected to return — for example, the JavaScript template for a General script:
javascript
Work on the template to build the script that you need. Whatever the script type, the standard inputs — variables, flow variables and metadata — are always available to your script.
The full-screen editor
For longer scripts, click the expand icon (top right) to open the full-screen editor:

Everything you need is still to hand — the manual/AI toggle, version menu, save, and a collapsible test panel so you can run the script without leaving full-screen mode. Click the collapse icon to return to the standard view.
Saving your work
When you're ready, save the script:
Save— saves the current version and stays on the page.Save & continue— saves the current version and moves you on.
Having saved your code, make sure you test it before deploying.
Last updated
Was this helpful?