Hi,
today i created a escalation service in Script runner to update some custom fields.
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.link.IssueLink;
def issueLinkManager = ComponentManager.getInstance().getIssueLinkManager()
def customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
def cfEst1 = customFieldManager.getCustomFieldObject("customfield_13233");
def cfEst2 = customFieldManager.getCustomFieldObject("customfield_13234");
def cfEst3 = customFieldManager.getCustomFieldObject("customfield_13235");
def cfEst4 = customFieldManager.getCustomFieldObject("customfield_13236");
def cfEst5 = customFieldManager.getCustomFieldObject("customfield_13237");
def cfEstUncategorized = customFieldManager.getCustomFieldObject("customfield_13238");
def ticket = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_13621");
def changeHolder = new DefaultIssueChangeHolder();
double totalRemaining = 0;
for(IssueLink link in issueLinkManager.getInwardLinks(
issue.id)){
if (
link.issueLinkType.name == "Epic Link")
{
def linkedIssue = link.sourceObject;
def total = 0;
if ( cfEst1 && linkedIssue.getCustomFieldValue(cfEst1)!=null)
total = total + linkedIssue.getCustomFieldValue(cfEst1);
if ( cfEst2 && linkedIssue.getCustomFieldValue(cfEst2)!=null)
total += linkedIssue.getCustomFieldValue(cfEst2);
if ( cfEst3 && linkedIssue.getCustomFieldValue(cfEst3)!=null)
total += linkedIssue.getCustomFieldValue(cfEst3);
if ( cfEst4 && linkedIssue.getCustomFieldValue(cfEst4)!=null)
total += linkedIssue.getCustomFieldValue(cfEst4);
if ( cfEst5 && linkedIssue.getCustomFieldValue(cfEst5)!=null)
total += linkedIssue.getCustomFieldValue(cfEst5);
if ( cfEstUncategorized && linkedIssue.getCustomFieldValue(cfEstUncategorized)!=null)
total += linkedIssue.getCustomFieldValue(cfEstUncategorized);
totalRemaining += total;
}
}
if (
issue.issueType.name == "Epic" ){
issue.setCustomFieldValue(ticket, totalRemaining);
ticket.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(ticket), totalRemaining), changeHolder);
}
Now i see when this query has run successfully then the resolution is put to Fixed without doing anything.
The action is all not filled in in the escalation service. Somebody who knows the reason?
kr,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.