hello ,
I'm very new to groovy and
I would like help to write a groovyscript that will copy the date in DUEDATE field to a custom field of date type.
Hi, @ayala nayman
Something like this should do the trick:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.ApplicationUser
MutableIssue issue = issue
ApplicationUser actor = ComponentAccessor.getUserManager().getUserByName("userNameWhoRunsTheScript")
CustomField dateField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("customFieldName")
issue.setCustomFieldValue(dateField, issue.getDueDate())
ComponentAccessor.getIssueManager().updateIssue(actor, issue, EventDispatchOption.ISSUE_UPDATED, false)
thanks a lot ! I used in the escalation services of script runner works great :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.