Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Automatic creation of field-dependent number of subtask

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:

  • Option A - there should be  no change fot the number defined in the Iteration field
  • Option B - the number defined in the iteration field should be divided in half

2. Second step is to link newly created issues only with their parent

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 06, 2023

Hi @Rafał Falisz

Were you able to find a solution for this?

Thank you and Kind regards,
Ram

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events