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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.