This service is named
scripts and allows you to write and run the business logic of your application.
To see the menu entry Scripts on the portal, you need to have the permission
If you have the permission
scripts=*, you can have access to all the functions mentioned below.
View the scripts¶
To read all the scripts, you need to have the permission
Otherwise, you cannot read the data.
If your permission has values like this:
scripts=read('Script 1', 'Script 2'), you will only see the scripts Script 1 and Script 2.
With the permission
scripts=read, you will not be able to edit the resources.
You can view a script’s resources by double-clicking on the line associated with the script.
On the left, you have the list of resources and on the right the code editor.
A resource consists of a name, a type (Groovy, XML, HTML, XSLT, TEXT, TypeScript) and a content. By clicking on a resource’s name, you display the content in the code editor.
Run a script¶
To run a script, you need to have the permissions
You can run a script from the code editor’s tab. You will have at your disposal three buttons on the top right of the code editor to manage the script running.
You can only run a script if all your modifications on the resources have been saved.
This button allows you to display or hide the console below the code editor. This console shows the logs during the script execution. It will automatically open at the start of the execution.
Add pipeline variables¶
This button displays a modal view, add or remove execution pipeline variables. Pipeline variables are not required and consist of a key (which cannot be empty) and a value. You can run your script from this modal.
Start/Stop the execution¶
This button starts the execution of the script with any entered pipeline variables. Once started, the logs will be displayed in the shell, but you can stop the execution with the button Stop.
Edit the scripts¶
To edit the scripts, you need to have the permissions:
When a script is created, it will create by default a Groovy resource, named
main. It will be your entry point when running the script.
You can access to the code editor by double-clicking on a script in the grid and with the permission
scripts=edit, you will be able to save your changes.
Edit a script’s details¶
Click on the top right button Edit details. You will be able to update the script’s name and description.
The script’s name and the English description are mandatory and cannot be empty.
Edit a script’s resources¶
Back on the main Edit tab, you can manage the scrip’s resources. Thus you can:
- create a new resource
- rename a resource
- duplicate a resource
- delete a resource
None of the actions above is available for the main resource.
You can use the keyboard shortcut
Ctrl + s/
Cmd + s to save your changes in the code editor.
Adding a new resource will open a new tab with a form. You will be asked to choose a unique name and to select a type of your new resource.
To rename a resource, you need to double-click on the resource’s name in the list. An input will be displayed and you will be able to choose a new name.
To validate the new name, press Enter, otherwise click anywhere else. As for the script’s name, you will get a notification if the resource’s name is already taken.
To duplicate a resource, click on the resource’s name and click on the button Duplicate. A new resource based on the initial resource will directly be created. Only, the name will be indexed.
To delete a resource, click on the resource’s name and click on the button Delete. You will be first asked to confirm the deleting.