It's my start in programming journey, hope you can help me with that (explanation would be a massive help)
def Publication = issue.fields.customfield_15190?.value
def Structure = issue.fields.customfield_15189?.value
def Iteration = issue.fields.customfield_14254?.value
def key = issue.key
def summary = issue.fields.summary
def priority = issue.fields.priority
List fieldsMaps = []
if (Publication.contains("CB"))
{
logger.info("creating CB")
fieldsMaps.add(["project":["key": "TPP"], "issuetype":["id": "11757"]]) //Core - 11757
}
if (Publication.contains("Fs"))
{
logger.info("creating Fs")
fieldsMaps.add(["project":["key": "TPP"], "issuetype":["id": "11758"]]) //Focus - 11758
}
if (Publication.contains("NOF"))
{
logger.info("creating NOF")
fieldsMaps.add(["project":["key": "TPP"], "issuetype":["id": "11759"]]) //NOF - 11759
}
if (Publication.contains("Others"))
{
logger.info("creating ")
fieldsMaps.add(["project":["key": "TPP"], "issuetype":["id": "11760"]]) //Other - 11760
}
def createdBacklogItems = []
//build a list of alrady linked implementation tasks
def implementationKeys = [:]
def linkedIssues = issue.fields.issuelinks
logger.info("${linkedIssues}")
for (linkedIssue in linkedIssues) {
def implementationKey = (linkedIssue.inwardIssue?: linkedIssue.outwardIssue).key
if (linkedIssue.type.name == "Issue split") {
implementationKeys[implementationKey.split("-")[0]] = implementationKey
}
}
logger.info("${implementationKeys}")
for(backlogItem in fieldsMaps)
{
backlogItem["summary"] = summary
logger.info(backlogItem.toString()
)
//creation
def createdIssue = post("/rest/api/3/issue")
.header("Content-Type", "application/json")
.body([
fields: backlogItem
])
.asObject(Map)
.body
logger.info("${createdIssue}")
createdIssueKey = createdIssue.key
if (!createdIssueKey){
throw new Exception("Creation has not succeeded")
}
}
//create link
def resultLink = post("/rest/api/3/issueLink")
.header("Content-Type", "application/json")
.body([outwardIssue: [
key: issue.key
],
inwardIssue: [
key: createdIssueKey
],
type: [
name: "Issue split"
]
]).asString()
logger.info("${resultLink}")
The process should look like this:
1. Each time ticket reaches a certain status (workflow post-function), a certain number of cases of a certain type should be automatically created
Publication - is a field that allows you to choose what type of case you want to create
Iteration - determines the number of created cases
Structure - also determines the number of created cases (this field has 2 options:
2. Second step is to link newly created issues only with their parent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.