Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.84 KB | None | 0 0
  1. import com.atlassian.jira.component.ComponentAccessor
  2. import com.atlassian.jira.event.type.EventDispatchOption
  3.  
  4. def cfm = ComponentAccessor.customFieldManager
  5. def issueManager = ComponentAccessor.issueManager
  6.  
  7. def startDate = cfm.getCustomFieldObjectByName("Downtime From")
  8. def endDate = cfm.getCustomFieldObjectByName("Downtime To")
  9. def days = cfm.getCustomFieldObjectByName("Downtime Durration")
  10.  
  11. def issueStartDate = issue.getCustomFieldValue(startDate) as Date
  12. def issueEndDate = issue.getCustomFieldValue(endDate) as Date
  13.  
  14. def duration
  15. use(groovy.time.TimeCategory) {
  16.     duration = ((issueEndDate.getTime() - issueStartDate.getTime()) / 1000) / 60
  17. }
  18.  
  19. issue.setCustomFieldValue(days,duration.toString())
  20. issueManager.updateIssue(ComponentAccessor.jiraAuthenticationContext.loggedInUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement