Hi Guys,
I need to calculate the time taken to resolve the issue in days, I am trying to do this using scriptrunner post function & store the value in another custom field, lets say the field Resolution in Days.
Here is the code that I am using but its not working, Can someone check whats wrong with it ?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import java.text.SimpleDateFormat
import java.util.Date.*
import com.onresolve.jira.groovy.user.FormField
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def resolutionDate = issue.getResolution();
def createdDate = issue.getCreated();
def RDate = resolutionDate.getValue() as Date
def SDate = createdDate.getValue() as Date
def ResolutionDays = getFieldById("customfield_xxxxxx")
ResolutionDays.setFormValue(RDate - SDate)