Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create issue at the start of each month.

Edited

I am using Scriprunner to do this, script below.... This is literally copy/pasted from Scriptrunner's site.... so WHY isnt it resolving in either the console, or a custom job? Link: https://scriptrunner.adaptavist.com/latest/jira/custom-script-jobs.html

 

import com.atlassian.jira.component.ComponentAccessor

def issueService = ComponentAccesssor.issueService
def projectManager = ComponentAccessor.projectManager
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

def issueInputParameters = issueService.newIssueInputParameters()

issueInputParameters.with {
projectID = projectManager.getProjectObjByKey("MPLX-AWAN").id
summary = "Update Virus Definitions"
issueTypeId = "10001"
reporterId = user.name
}

def validationResult = issueService.validateCreate(user, issueinputParameters)
assert !validationResult.errorCollection.hasAnyErrors()

def issueResult = issueService.create(user, validationResult)
log.info "Issue created: ${issueResult.issue}"

 

Error is : Failed type checking: Not all types of code can be checked. It's yelling about the first line. 

2 answers

1 vote

Check for typos and correct case (groovy is case sensitive.

I found 3 errors:

  1. There are 3 s in Accessor
    • def issueService = ComponentAccesssor.issueService
  2. The correct property for project in issueInputParamter is projectId not projectID
  3. You labeled you variable issueInputParamters, but then tried to pass issueinputParameters (no capital i for input) to the validateCreate method

This compiles for me

import com.atlassian.jira.component.ComponentAccessor

def issueService = ComponentAccessor.issueService
def projectManager = ComponentAccessor.projectManager
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

def issueInputParameters = issueService.newIssueInputParameters()

issueInputParameters.with {
projectId = projectManager.getProjectObjByKey("MPLX-AWAN").id
summary = "Update Virus Definitions"
issueTypeId = "10001"
reporterId = user.name
}

def validationResult = issueService.validateCreate(user, issueInputParameters)
assert !validationResult.errorCollection.hasAnyErrors()

def issueResult = issueService.create(user, validationResult)
log.info "Issue created: ${issueResult.issue}"

Hey there Zachary,
I'm the lead tech writer at Adaptavist and I just wanted to let you know that we saw your post and our tech writer has edited our documentation to make copy/pasting that script easier. You can find that documentation here: https://docs.adaptavist.com/sr4js/latest/features/jobs/custom-jobs. Hope that helps (or helps someone else in the future.) Thanks for bringing this to our attention!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

130 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you