Skip to content

Scripts Guide

This service is named scripts and allows you to write and run the business logic of your application.

To see the Scripts menu entry on the portal, you need to have the scripts=view permission.

Note

If you have the scripts=* permission, you can have access to all the functions mentioned below.

View the Scripts

To have access to all the Scripts, you need to have the scripts=read 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 Script 1 and Script 2 Scripts.

Warning

With the scripts=read permission, you will not be able to edit the resources.

You can view the resources of a Script by double-clicking on the line associated with this Script.

On the left, you have the list of resources and on the right the code editor.

List of resources

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 scripts=read and scripts=run 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.

Code editor running buttons

Warning

You can only run a Script if all your modifications on the resources have been saved.

Display logs

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.

Pipeline variables

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.

Run/Stop execution

Edit the scripts

To edit the Scripts, you need to have the following permissions: scripts=read and scripts=edit.

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.

Tip

Please read:

  • the section Groovy guide to take advantage of the plugins added to Platform 6 Groovy interpreter
  • the section Scripts libraries to share resources between Scripts

You can access to the code editor by double-clicking on a Script in the grid and with the scripts=edit permission, you will be able to save your changes.

Edit the resources

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.

Edit the details

Warning

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 Script’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.

Tip

You can use the keyboard shortcut Ctrl + s/Cmd + s to save your changes in the code editor.

Creating

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.

Renaming

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.

Duplicating

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.

Deleting

To delete a resource, click on the resource’s name and click on the button Delete. You will be asked to confirm the deleting.