Currently, we have routine issues where the status resets each week. This escalation service is working as intended. However, we are trying to incorporate the following script to adjust the system field 'DueDate' to be set for 7 days from the date when the escalation fires. The following code updates the date and returns the correct value but it doesn't appear to be committing the date of the provided ISSUEKEY.
Here is our code:
import java.sql.Timestamp
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueManager im=ComponentAccessor.getIssueManager()
MutableIssue issue = im.getIssueObject('ISSUEKEY')
issue.setDueDate(new Timestamp((new Date() + 7).time))
issue.getDueDate()
May I know where you are running this script?
1. Post-Function?
>>> If so check the order of post-function, it should be top of re-index post-function
2. Script Listener?
>>> if so you'll have to include "EventDispatchOption" method
def issueManager = ComponentAccessor.getIssueManager()
def appUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
//place duedate update code here
issueManager.updateIssue(appUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
Hope this helps
BR,
Leo
Trying to run it in the build-in script as part of an escalation service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Michael Edwards
I believe you might find your answer in the thread: https://community.atlassian.com/t5/Jira-questions/Script-Runner-Due-date-Set-Up/qaq-p/868148 👀
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.