def issueManager = ComponentAccessor.getIssueManager()
def issueId = queryParams.getFirst("issueId") as Long
def issue = issueManager.getIssueObject(issueId.toString())
log.warn(issueId)
def issueSum=issue.getSummary()
Hi im working on rest end point when I try to create issue object I'm getting Null pointer exception
error message:
{"message":"Cannot invoke method getSummary() on null object","stack-trace":"java.lang.NullPointerException: Cannot invoke method getSummary() on null object\r\n\tat Script327$_run_closure1.doCall(Script327.groovy:61)\r\n\tat com.onresolve.scriptrunner.runner.rest.common.UserCustomScriptEndpoint$_doEndpoint_closure2.doCall(UserCustomScriptEndpoint.groovy:186)\r\n\tat com.onresolve.scriptrunner.runner.rest.common.UserCustomScriptEndpoint$_doEndpoint_closure2.doCall(UserCustomScriptEndpoint.groovy)\r\n\tat com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl$_execute_closure1.doCall(DiagnosticsManagerImpl.groovy:359)\r\n\tat com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl$_execute_closure1.doCall(DiagnosticsManagerImpl.groovy)\r\n\tat com.onresolve.scriptrunner.runner.ScriptExecutionRecorder.withRecording(ScriptExecutionRecorder.groovy:13)\r\n\tat com.onresolve.scriptrunner.runner.ScriptExecutionRecorder$withRecording$0.call(Unknown Source)\r\n\tat com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl.execute(DiagnosticsManagerImpl.groovy:357)\r\n\tat com.onresolve.scriptrunner.runner.rest.common.UserCustomScriptEndpoint.doEndpoint(UserCustomScriptEndpoint.groovy:219)\r\n\tat com.onresolve.scriptrunner.runner.rest.common.UserCustomScriptEndpoint.getUserEndpoint(UserCustomScriptEndpoint.groovy:70)\r\n","status-code":"INTERNAL_SERVER_ERROR"}
Looking at the method signatures for getIssueObject() in this resource, I see that it can be passed either a Long or a String. If it's a Long, it should be the issue ID; if it's a String, it should be the issue key. It looks like you are passing the ID as a String (and hence the method looks for an issue with that key); try passing it instead as a Long, i.e.
def issue = issueManager.getIssueObject(issueId)
Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.
Get Certified! ✍️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.