we have a Due Date Field in our Epics and Stories. People would like to work in the Portfolio and the Roadmaps there are only shown if u select a target start and target end. I created a function in Scriptrunner that copies the Date of the "Due Date" Field into the "Target End" Field. It works but it allways copies the date with -1. SO the Date is never correct. when i enter 30. as Due Date it copies 29. into Target End. Can anybody help me with this?
Try something like this:
def indexManager = ComponentAccessor.getComponent(IssueIndexManager)
def issueService = ComponentAccessor.issueService
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey('PT-1858')
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName('yourDateField');
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), issue.getDueDate()),new DefaultIssueChangeHolder()); // update values
boolean wasIndexing = ImportUtils.isIndexIssues();
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events