toString()

Number

This function converts the decimal representation of a number (or timestamp) into plain text

This is one of the most commonly used functions in JWT.

Whenever any type of list is returned by a field code or parser function (e.g. subtasks()) and you are using the advanced text parsing mode, the toString() function converts the output to a readable format.

This is especially helpful if you want to test your expression.

Bash
 toString(number) #Output: Text

Examples

Parser expression

Description

Bash
toString(3.141592)

This example returns the text:

"3.141592"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

number

number

Any given number or numerical field code.

Output

This function returns a text

Number decimal placing

Variant where you can additionally define the number of decimal places.

Bash
 toString(number, decimalPlaces) #Output: Text

Examples

Parser expression

Description

Bash
toString(3.141592, 2)

This example returns the text:

"3.14"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

number

number

Any given number.

decimalPlaces

number

Any positive number.

Output

This function returns a text

Number list

This function converts any number list into plain text.

A comma-separated text with the decimal representation of each numeric value will be returned.

Bash
 toString(numberList) #Output: Text

Examples

Parser expression

Description

Bash
toString([1, 2, 3, 4.0])

This example returns the text:

"1, 2, 3, 4"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

numberList

number list

Any given number list.

Output

This function returns a text

Number list decimal placing

Variant where you can additionally define the number of decimal places.

Bash
 toString(numberList, decimalPlaces) #Output: Text

Examples

Parser expression

Description

Bash
toString([1.123, 2.452, 3.64612], 2)

This example returns the text:

"1.12, 2.45, 3.65"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

numberList

number list

Any given number list.

decimalPlaces

number

Any positive number.

Output

This function returns a text

Number list decimal placing and separator

Variant where you can additionally define a specific separator.

Bash
 toString(numberList, decimalPlaces, separator) #Output: Text

Examples

Parser expression

Description

Bash
toString([1.123, 2.452, 3.64612], 2, " : ")

This example returns the text:

"1.12 : 2.45 : 3.65"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

numberList

number list

Any given number list.

decimalPlaces

number

Any positive number.

separator

text

Any separator character.

Output

This function returns a text

Text list

This function converts any text list into plain text.

A comma-separated text with each value will be returned.

Bash
 toString(textList) #Output: Text

Examples

Parser expression

Description

Bash
toString(["Hello", " ", "world", "!"])

This example returns the text:

"Hello, , world, !"

Bash
toString(fieldValue(%{issue.reporter}, subtasks()))

This example returns the user names of all sub-task reporters, e.g.:

"b.smith, a.grant"

To achieve this the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

textList

text list

Any given text list.

Output

This function returns a text

Text list separator

Variant where you can additionally define a specific separator.

Bash
toString(textList, separator) #Output: Text

Examples

Parser expression

Description

Bash
toString(["blue", "red", "green"], "; ")

 

This example returns the text:

"blue; red; green"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

textList

text list

Any given text list.

separator

text

Any separator character.

Output

This function returns a text

Issue list

Converts an issue list into a comma-separated text containing issue keys.

Bash
toString(issueList) #Output: Text

Examples

Parser expression

Description

Bash
toString(subtasks())

 

This example might return:

 "CRM-5, CRM-6 "

To achieve this the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

issueList

issue list

Any given issue list. Usually this value is retrieved from a function (e.g. linkedIssues() or subtasks()).

Output

This function returns a text

Issue list separator

Variant where you can additionally define a specific separator.

Bash
toString(issueList, separator) #Output: Text

Examples

Parser expression

Description

Bash
toString(subtasks(), " ")

This example might return: 

"CRM-5 CRM-6 CRM-7"

Bash
toString(subtasks(), ";")

This example might return: 

"CRM-5;CRM-6;CRM-7"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

issueList

issue list

Any given issue list. Usually this value is retrieved from a function (e.g. linkedIssues() or subtasks()).

separator

text

Any separator character.

Output

This function returns a text

(books) Use cases and examples

Use case Workflow function Field type Automated action Parser functions
Add comment with the request participants' display name

Add comment

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

Create issue under epic

Create issue

toString() epic()

Create a sub-task for every sub-task closed

Create issue

findReplaceFirst() first() findPattern() toString() sum() toNumber()

Obtain a value from an Elements Connect custom field

Send email

findPattern()

toString()

Clone epic, tasks and sub-tasks

Create issue

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

Set fix version based on its start and release date

Update or copy field values 

toString() textOnStringList() unreleasedVersions() startDates() releaseDates() first()

Match several values of a list

Update or copy field values

toString() distinct() filterByPredicate()

Components from all sub-tasks

Text

toString()

distinct()

fieldValue()

subtasks()

Link issue to issue keys in its description

Create issue link

findPattern() toString()

Triage issues created by email

Move issue

toUpperCase() 

toString() 

findPattern() 

isInGroup()

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 watchers ignoring inactive users

Update or copy field values

usersInGroup() isActive() toString() filterByPredicate()

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

Send email

toString() textOnStringList() toStringList()

Display historic due dates

Text

toString()

textOnNumberList()

fieldHistory()

dateToString()

Link to the linked epic from the current issue

Text

toString()

fieldValue()

issueKeysToIssueList()

Track issues mentioned in comments

Create issue link action

findPattern()

issueKeysToIssueList()

toString()

Link to JQL query with information from issue

Text

toString()

textOnStringList()

toStringList()

Send email with the URL of the attachments included in the description

Send email

replaceAll() toString() attachmentUrls() findPattern()

Display reporters of linked Cloud issues

Text

executeRemoteAction()

findPattern()

toStringList() 

toString() 

distinct()