toStringList()

Text

This function converts a comma-separated text into a text list.

A common use case is a text list representing the selected elements of a selectable field, e.g. components.

If you want to test the output or need the actual text instead of a list, wrap your expression in a toString() function.

Bash
toStringList(text) #Output: Text list

Examples

Parser expression

Description

Bash
toStringList(%{issue.components})

This example returns a text list with each of the components selected in the current issue, e.g.:

["ui", "portal"]

Bash
count(toStringList(%{issue.labels}))

This example returns the number of labels attached to the current issue, e.g.:

2

To achieve this, the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

text

text

Any comma-separated text satisfying the format: "Element1, Element2".

This function is often used in combination with Selectable field options.

Output

The function returns a text list

Text with separators

Variant where you can additionally define custom separators.

Leading and trailing spaces around each list element are automatically removed.

Bash
toStringList(text, separators) #Output: Text list

Examples

Parser expression

Description

Bash
toStringList("red, orange, yellow? green; blue; purple", ",?;")

This example returns the text list:

["red", "orange", "yellow", "green", "blue", "purple"]

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

text

text

Any text with elements separated by the characters defined in the second argument.

separators

text

Any separator character.

Output

The function returns a text list

(books) Use cases and examples

Use case Workflow function Field type Automated action Parser functions
Prevent a transition depending of the number of components

Logical validator

Logical condition

numberOfSelectedItems()

Add comment with the request participants' display name

Add comment

toString()  textOnStringList() toStringList() userDisplayName()

Evaluate Assets objects

Logical validator

Logical condition

findPattern() findReplaceAll() replaceAll() toStringList()

Clone epic, tasks and sub-tasks

Create issue

toString() toStringList() issueKeysToIssueList() replaceFirst() first() fieldValue() textOnStringList() findModify() subtasks() issuesUnderEpic()

Create sub-tasks depending on selected values in custom field

Create issue

toStringList()

Create sub-tasks depending on selected values in a custom field

Create issue action

toStringList()

Create a sub-task for each component

Create issue

toStringList()

Create several issues combining fields

Create issue

nthElement() toStringList() modulus() count() ceil()

Reject duplicated file names in attachments

Logical validator

Logical condition

count()

toStringList()

distinct()

Add components of the epic to the current issue

Update field action

Prevent external users from creating issues

Logical validator

matches() toString() textOnStringList() toStringList() userDisplayName()

Add links to the issues in a ScriptRunner Issue Picker field

Create issue link action Delete issue link action

issueKeysToIssueList() toString() toStringList() replaceAll() previousValue()

Add a table with the elements of a text to an email

Send email

toString() textOnStringList() toStringList()

Halt a transition if an element is not contained in a list

Logical validator Logical condition

toStringList()

Create a sub-task for every user in a field and assign them

Create issue

getMatchingValue()

toStringList()

Change the assignee to the next evaluator

Update or copy field values

first()

toStringList()

Link to JQL query with information from issue

Text

toString()

textOnStringList()

toStringList()

Display reporters of linked Cloud issues

Text

executeRemoteAction()

findPattern()

toStringList() 

toString() 

distinct()