Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

GThis Plugin gives some extremely nice features, like:

...

Kodeblok
import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.CustomFieldManager
 
componentManager (componentManager) ComponentAccessor.getComponentManager();

optionsManager = (optionsManager) ComponentAccessor.getOptionsManager();
customFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Task Type'}
def fieldConfig = cf.getRelevantConfig(issue)
def optionClone = optionsManager.getOptions(fieldConfig).find {it.value == "Clone"}
issue.setCustomFieldValue(cf, optionClone)

 

Condition for Link

This script sends "passesCondition = false" if there is an "Awaiting" Link type on the Issue. 

Kodeblok
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Category
IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();
String IssueType      = issue.getIssueType().name
String ProjectName    = issue.getProjectObject().name
String IssueKey       = issue.key
passesCondition = true
System.out.println("script=CheckTOPSLinkStatus.groovy Issuekey: " + IssueKey + " IssueType: " + IssueType + " ProjectName: " + ProjectName + " action=StartScript")
//Traverse all links
issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->
   String LinkTypeName    = issueLink.issueLinkType.name
   String LinkStatus      = issueLink.getDestinationObject().getStatus().name
   String LinkIssueKey    = issueLink.getDestinationObject().key
   System.out.println("script=CheckTOPSLinkStatus.groovy Issuekey: " + IssueKey + " Issue Link key: " + LinkIssueKey + " Issue Link Type: " + LinkTypeName + " Linked Issue Status: " + LinkStatus)
   if (LinkTypeName == "Relates")
   {
        passesCondition = false
        System.out.println("script=CheckTOPSLinkStatus.groovy Issuekey: " + IssueKey + " IssueType: " + IssueType + " ProjectName: " + ProjectName + " action=Hide Transition")
   }
}
System.out.println("script=CheckTOPSLinkStatus.groovy Issuekey: " + IssueKey + " IssueType: " + IssueType + " ProjectName: " + ProjectName + " action=EndScript")

 

Setting Issue values after "Create Subtask" 

...