Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner exit code

Nor Hisham Nordin October 31, 2022

What is scriptrunner equivalent to sys.exit() to exit script if condition is met. 

Sample code flow to handle only if the ticket is related to vendor:
def a = issue.fields["customField_10111"] 

if(a != "Vendor") {
   sys.exit()     //import sys is not available. 
}

if( issue_fields["customField_10112"] == "Configuration") {
   def result = put("/rest/api/2/issue/${issueKey}").header('Content-Type', 'application/json')
      .body ([ fields: [
         customField_10113: "Require Vendor Agreement"
      ] ]).asString()

      def email = post("https://somewebhook.com/webhook1/" + ${issueKey)).asString()
}

if( something ) { 
   do something
}


1 answer

1 accepted

2 votes
Answer accepted
Dirk Ronsmans
Community Champion
November 1, 2022

Hey @Nor Hisham Nordin 

Since it's Groovy you should be able to "exit" the code simply by using a "return" statement.

Nor Hisham Nordin November 1, 2022

Thank you very muchhh

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events