...
This page provides Groovy script examples to interact with Asset asset custom fields and Jira issues within your Jira workflows. These scripts can be used in post functions to update Asset asset attributes based on Jira issue transitions.
Tip |
---|
You can directly use |
On this page:
|
---|
...
Get "Select List (single choice)" or or "Radio Buttons" JIRA custom field value
...
You can directly use issue
or originalIssue
of the transition, or get another issue with IssueManager (like the example below).
Code Block |
---|
import com.atlassian.jira.issue.Issue import com.atlassian.jira.component.ComponentAccessor def anotherIssue = ComponentAccessor.getIssueManager().getIssueObject("AP-5"); def issueManager = ComponentAccessor.getIssueManager() def customFieldManager = ComponentAccessor.getCustomFieldManager() def cField = customFieldManager.getCustomFieldObject("customfield_11001") def cFieldValue = anotherIssue.getCustomFieldValue(cField) def cityNameList = new ArrayList<String>() for(String cityName: cFieldValue){ cityNameList.add(cityName) } return String.join(", ", cityNameList) |
...
Expand | ||
---|---|---|
| ||
Example result: Done |
Get resolution of an other another issue
Please note that getResolution
may be null for unresolved issues.
...
If you want to assign a date
or dateTime
asset attribute, the value must be in ISO time format (for example, 2018-11-06T10:24:37.513
).
For Date-Time fields,
second
and rest of the value will be purged automatically. Result example:2018-11-06T10:24
.For date fields,
minute
and rest of the value will be purged automatically. Result example:2018-11-06
.
...
If you want to assign a date
or dateTime
asset attribute, the value must be in ISO time format (for example, 2018-11-06T10:24:37.513
).
For Date-Time fields,
second
and rest of the value will be purged automatically. Result example:2018-11-06T10:24
.For date fields,
minute
and the rest of the value will be purged be purged automatically. Result example:2018-11-06
.
...
If you want to assign a date
or dateTime
asset attribute, the value must be in ISO time format (for example, 2018-11-06T10:24:37.513
).
For Date-Time fields,
second
and the rest of the value will be purged automatically. Result example:2018-11-06T10:24
.For date fields,
minute
and the rest of the value will be purged be purged automatically. Result example:2018-11-06
.
...