> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Working With Groovy

> Groovy is a scripting language that FlexDeploy uses in many places. It allows users to configure values of inputs and variables based on context. Usag

Groovy is a scripting language that FlexDeploy uses in many places. It allows users to configure values of inputs and variables based on context.

### Usage

To enable Groovy code for an input, click the ***curly braces*** next to a value. Some inputs are locked to Groovy mode and can’t be toggled.

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/d70xZJSQ0kNavvGo/images/fd90/10926702169.png?fit=max\&auto=format\&n=d70xZJSQ0kNavvGo\&q=85\&s=a52b2760b96278f71881f5a9080f3748)

once it’s enabled, you will see the purple ***script indicator***

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922756.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=d81b86a7c2fb3051b1cfbacfd62e7276)

on the left side.

The ***Maximize button***

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/d70xZJSQ0kNavvGo/images/fd90/10926702163.png?fit=max\&auto=format\&n=d70xZJSQ0kNavvGo\&q=85\&s=e7a1f99f730ffa31680e967f9b21b0d6)

on the right will enlarge the input so that you can see your code more easily.

Pressing ***Ctrl+ Space, period,*** will open a drop down of potential variables or functions available to you based on the context. Regular text values should be quoted.

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922768.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=1d68d262b801208278571e6de8ba14ab)

Clicking the ***Minimize button***

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922774.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=9fd89d7decf41ba8952ec00ea13a2ea3)

in the top right will collapse the input again and you can save your work.

If your Groovy Script has a compilation error, you will be notified when you save. Other errors are found at run time and will be found when the value is used.

In the above example, there was a compilation error. It shows this in the UI:

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922765.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=a27f94089add2d4fe17c407e7241356f)

Fix the problem, close the error popup, and save again.

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922771.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=d64dbcdfa5d1006866a26c7c3de73e70)

After adding the missing plus sign, the value saves successfully.

### Limitations

#### Imports

* Some scripts in FlexDeploy are appended to other scripts, such as File Type customizations. As a result, they cannot contain import statements.

* Multiline imports are not supported. For example:

  * ```
    import com.
    java.
    *);
    ```

* Static imports are not supported

  * ```
    import static com.java.mystatichelpers.staticmethod;
    ```

> [!NOTE]
>
> **FlexDeploy 10.0.0.0**
>
> Imports in File Type customizations and static imports are scheduled to be supported in FlexDeploy version 10.0.0.0

### Known Issues

If you make a multi-line groovy expression, and start lines with +, you may get the error

***\[No signature of method: java.lang.String.positive() is applicable for argument types: () values: \[] Possible solutions: notify(), tokenize(), size(), tokenize(), size()].***

In this case, move the + signs to the ends of the lines above.

e.g. this might not work:

```
"Test: " +  BranchName + EnvironmentCode
+ EnvironmentName + PackageName + ProjectName + ProjectVersion +
TargetGroupCode + TargetGroupName + WorkflowRequestor
```

but this will:

```
"Test: " +  BranchName + EnvironmentCode +
EnvironmentName + PackageName + ProjectName + ProjectVersion +
TargetGroupCode + TargetGroupName + WorkflowRequestor
```
