# Creating and attaching scripts

## Preliminary information <a href="#edytorskryptow-informacjewstepne" id="edytorskryptow-informacjewstepne"></a>

To create a new script or edit an existing one, go to the **Library** module and select the **Scripts.** A list of available scripts will be presented. From this view you can create a new script, review the script version history, create a copy, or edit an existing artifact.

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2Fki1U5yApq8y7UEd8R3zk%2Fimage.png?alt=media&#x26;token=2bda8dfb-914c-4dc6-9054-e34da9315f2f" alt=""><figcaption><p><em><strong>Illustration</strong></em> <em><strong>1.</strong>  Window with the list of scripts and the context menu of one of the artifacts</em></p></figcaption></figure>

## Creating a script <a href="#skrypty-scriptservice-tworzenieskryptu" id="skrypty-scriptservice-tworzenieskryptu"></a>

Script Service is one of the types of artifacts in the repository. To add a script service, use Eximee Designer and go to the **Library → Scripts**, then click the button on the right **Add script.**

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2FUeCfvZrrW9CqInRhe6Cs%2Fimage.png?alt=media&#x26;token=916847c8-ded3-4b75-9a33-f233487ae450" alt=""><figcaption><p><em><strong>Illustration 2.</strong> Adding scripts</em></p></figcaption></figure>

## Edit window <a href="#skrypty-scriptservice-oknoedycji" id="skrypty-scriptservice-oknoedycji"></a>

The edit window allows changing the script content, input and output parameters, and running the script on test data:

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2FLXrpNApvfxBJVA7vHBlg%2Fimage.png?alt=media&#x26;token=cce8ea5f-12dc-419a-a349-5b07953d13d1" alt=""><figcaption><p><em><strong>Illustration 3.</strong> Script service edit window</em></p></figcaption></figure>

## Attaching on the form <a href="#skrypty-scriptservice-podpiecienawniosku" id="skrypty-scriptservice-podpiecienawniosku"></a>

For a specific component in the **Properties** panel you should select **Interactions → External data source → Select service**, then choose the name of the script and assign the appropriate components to the input and output parameters.&#x20;

We can also attach scripts as input services, output services, and page services.

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2F6XCav6S6ygVChOGUJmqU%2Fimage.png?alt=media&#x26;token=6dd54b73-f849-42b8-92f7-c0fc23d46db0" alt=""><figcaption><p><em><strong>Illustration 4.</strong> Attaching a script to the application</em></p></figcaption></figure>

## Redirect to the script code <a href="#skrypty-scriptservice-przekierowaniedokoduskryptu" id="skrypty-scriptservice-przekierowaniedokoduskryptu"></a>

After attaching the script, an icon will appear on the right side of the window ![](https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2Fvkug4IFpxerQOFkymCfM%2Fimage.png?alt=media\&token=d487fb74-70f3-484f-9a16-91f3cb31d296) allowing navigation to the script source code. After clicking the icon, the editor window with the source of that script will open in the current browser tab. You can also right-click the icon and then choose to open the script source in a new tab or a new browser window.

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2F75b9xjAZlgW1OXiHAkPr%2Fimage.png?alt=media&#x26;token=cb935d50-9cb1-4c43-a60e-9607b0ac2bb6" alt=""><figcaption><p align="center"><em><strong>Illustration 5.</strong> Context menu of the icon directing to the script source</em></p></figcaption></figure>
