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

automatically delete a request ticket after subtask ticket is created on new parent.

Alex Sprague
Contributor
March 18, 2021

I have a script that sets a creates a subtask ticket to one of 20 different parent tickets. If this succeeds i end up with a subtask ticket and the initial request ticket. How do i script a way to delete the initial request ticket if the subtask create succeeds and then have the script fail out if a subtask is not created?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
John Chin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 24, 2021

Hi @Alex Sprague 

It would be great we can see the whole script and which scriptrunner feature that execute the script.

If you are using issueManager.createIssueObject method to create the subtask issue, you can return an Issue object if successful or else its returned null or exception:

try{

def newSubtask created = issueManager.createIssueObject(user,newparams)

}
catch(exception e){

//dosomething
}


if(newSubtask){

//delete the initial request ticket
}

Those are some examples, you may can change the script logic based on your desired requirement.  

TAGS
AUG Leaders

Atlassian Community Events