简体   繁体   English

使用 groovy/script runner [JIRA] 设置后提交 DueDate 时出现问题

[英]Trouble commiting DueDate after setting it with groovy/script runner [JIRA]

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.但是,我们正在尝试合并以下脚本来调整系统字段“DueDate”,使其设置为自升级触发之日起 7 天。 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.以下代码更新日期并返回正确的值,但它似乎没有提交提供的 ISSUEKEY 的日期。

Here is our code:这是我们的代码:

import java.util.Date
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()

What you are doing is correct but you need to commit your changes by calling IssueManager.updateIssue你在做什么是正确的,但你需要通过调用IssueManager.updateIssue来提交你的更改

import com.atlassian.jira.event.type.EventDispatchOption //add-this-line
import java.util.Date
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()

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()//add-this-line

im.updateIssue(currentUser, issue, EventDispatchOption.DO_NOT_DISPATCH  , false) //add-this-line

You are setting the issue value correctly but you are not saving your changes您正在正确设置问题值,但没有保存更改

IssueManager.updateIssue will save any changes IssueManager.updateIssue 将保存任何更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM