Example Scripted Fields
Along with the example Scripted Fields outlined below, we have added a demo video to help you understand how this feature works in ScriptRunner for Jira Cloud:
You can see below some examples that show how to use Jira APIs. The Scripted Fields feature in Cloud works differently from Sever/Data Center, where you must use one of the return types specified.
Groovy Scripts
Remember, our scripts are written in Groovy! Check out our page on Scripting in ScriptRunner for Jira Cloud for tips.
Currency Conversion Number Field
The following example shows the conversion of a field value, into a specific currency using a publicly available currency conversion API. A Jira custom field (number) called Cost (USD) has already been set up in the target project. The following script takes the Cost (USD) value, converts it to EUR, and displays the result in a scripted field:
Last Comment Scripted Field
The following example shows how you can extract the last comment of an issue and to display the value of it inside a script field on the issue sidebar.
This then allows you to easily see what was added to the last comment on the issue without having to scroll through all of the comments on the issue.
This field should be configured to have a Text Field return type and should be configured to display in the Issue sidebar location.
Sum up Story Points Below An Epic Issue Scripted Field
The following example shows how you can return all the Story issues below an Epic issue and to sum up the Story Points field for these and then display this value inside a script field on the Epic issue.
This then allows you to easily see how many story points you have set for all stories inside of your Epic issue.
This field should be configured to display for just the Epic issue type and to have a Number return type as well as to be configured to display in the Issue sidebar location.