...
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
This page is about Assets & Inventory Plugin for Jira DC. Using Cloud? Click here. |
Please note that you can directly use issue or originalIssue of the transition, or fetch an issue by key or id with IssueManager (like anotherIssue in examples).
return statements are optional but it makes script more readable.
On this page:
|
---|
Get Asset's Attribute value
Code Block |
---|
return aipUtils.getAttributeValueAsStringByName(asset, 'Quantity'); |
Result: 40 40
Get Asset's Multiple Value Attribute values by name as List
Code Block |
---|
import inventoryplugin.entity.JipInventoryItem; import org.apache.commons.lang3.StringUtils; String getMultipleValues() { def result = ''; def cityList = aipUtils.getMultiAttributeValueAsListByName(asset, 'Cities ListBox Multiple'); for (String city : cityList) { result += city + ', ' } return result; } return getMultipleValues(); |
Result:
...
New
...
York,
...
London,
Get Asset's Multiple Value Attribute values by ID as List
...
Code Block |
---|
return issue.getResolution() != null ? issue.getResolution().getName(): "Not resolved" |
Result: Done
Get resolution of an other issue
Please note that getResolution may be null for unresolved issues.
...
If you want to assign a date or dateTime asset attribute, value must be in ISO time format, i.e: 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
Code Block |
---|
import java.time.* import com.atlassian.jira.issue.Issue import com.atlassian.jira.component.ComponentAccessor def anotherIssue = ComponentAccessor.getIssueManager().getIssueObject("SB-146") return anotherIssue.getCreated().toLocalDateTime().toString() // or use getUpdated insted of getCreated |
...
If you want to assign a date or dateTime asset attribute, value must be in ISO time format, i.e: 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
Code Block |
---|
import java.time.* import com.atlassian.jira.issue.Issue import com.atlassian.jira.component.ComponentAccessor def anotherIssue = ComponentAccessor.getIssueManager().getIssueObject("SB-146") return anotherIssue.reporter.username // or "anotherIssue.assignee.username" |
...
If you want to assign a date or dateTime asset attribute, value must be in ISO time format, i.e: 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
Code Block |
---|
import java.time.* LocalDateTime t = LocalDateTime.now(); return (t as String) |
...