Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.atlassian.jira.component.ComponentAccessor
- import com.atlassian.jira.event.type.EventDispatchOption
- def cfm = ComponentAccessor.customFieldManager
- def issueManager = ComponentAccessor.issueManager
- def startDate = cfm.getCustomFieldObjectByName("Downtime From")
- def endDate = cfm.getCustomFieldObjectByName("Downtime To")
- def days = cfm.getCustomFieldObjectByName("Downtime Durration")
- def issueStartDate = issue.getCustomFieldValue(startDate) as Date
- def issueEndDate = issue.getCustomFieldValue(endDate) as Date
- def duration
- use(groovy.time.TimeCategory) {
- duration = ((issueEndDate.getTime() - issueStartDate.getTime()) / 1000) / 60
- }
- issue.setCustomFieldValue(days,duration.toString())
- issueManager.updateIssue(ComponentAccessor.jiraAuthenticationContext.loggedInUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement