> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/developer-documentation/case-scripting/adding-a-new-script.md).

# Adding a New Script

This lesson will show you how to add your own scripts to AgileCase in order to customize case behaviour.

{% stepper %}
{% step %}

## Add a new script

<figure><img src="https://2254578867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlbQndiLuyFlBYZOTuVGa%2Fuploads%2Fgit-blob-44a466f0c6d0239f49321a707da881c6cf7c891e%2Faddnewscript1.png?alt=media" alt=""><figcaption></figcaption></figure>

To add a new script, first click the "Add New Script" button. This will display the scripting form and allow you to proceed.
{% endstep %}

{% step %}

## Enter script details and set permissions

<figure><img src="https://2254578867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlbQndiLuyFlBYZOTuVGa%2Fuploads%2Fgit-blob-1f3185c502576efd3d77c628e28178812250e181%2Faddnewscript2.png?alt=media" alt=""><figcaption></figcaption></figure>

First of all you should name your new script and enter a short description. You can also select whether the script runs when the page is loaded or when the case is saved.

You can read more about On Load scripts [here](/developer-documentation/case-scripting/on-load-scripts.md) and more about On Save scripts [here](/developer-documentation/case-scripting/on-save-scripts.md).

You can also select which case types the script will be active in.
{% endstep %}

{% step %}

## Add script content

Once you have entered the details of the script, you are free to write the script itself in the "Script Content" box. Users that are familiar with JavaScript will have free reign over their case behavior.

How the script needs to be written depends on when it runs, so if you are starting from scratch it is worth reading [On Load Scripts](/developer-documentation/case-scripting/on-load-scripts.md) or [On Save Scripts](/developer-documentation/case-scripting/on-save-scripts.md) first. Both pages end with worked examples you can adapt by swapping in your own field IDs.

If you have no scripting experience or wish to create especially complex scripts, we can write custom scripts for you. If you are interested in this service, please contact us on <sales@agilecase.com> for more information and pricing.
{% endstep %}

{% step %}

## Save your script

<figure><img src="https://2254578867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlbQndiLuyFlBYZOTuVGa%2Fuploads%2Fgit-blob-587b887c74645f7e1920d1fb99e46d33610180af%2Faddnewscript3.png?alt=media" alt="" width="248"><figcaption></figcaption></figure>

Once you have completed your script, click the "Save Changes" button at the bottom of the page to save your script and add it to the system.

Alternatively, click "Cancel" to close the form without saving.
{% endstep %}
{% endstepper %}
