scriptrunner for jira cloud illegal character error

Mary Wilson August 30, 2019

I'm at my wits end.  I've been fighting this all morning and can't figure it out.  I'm getting the following error.  For what it's worth, it works like a charm in the script console!

2019-08-30 16:09:07.529 ERROR - java.net.URISyntaxException: Illegal character in path at index 90: https://avst.connect.adaptavist.com/proxy-service/rest/api/1/jira/proxy/rest/api/2/issue/${issue.key}
2019-08-30 16:09:07.531 ERROR - Class: com.adaptavist.sr.cloud.workflow.RunScript, Config: [className:com.adaptavist.sr.cloud.workflow.RunScript, uuid:c8514b86-b940-4843-97bd-b79eebd340b8, description:devChange calculation, enabled:true, executionUser:ADD_ON, additionalCode:// get custom fields

My script fires on a workflow transition:

def customFieldName = 'customfield_13635'

def result = get("/rest/api/2/issue/${issue.key}?fields=${customFieldName}")
.header('Content-Type', 'application/json')
.asObject(Map)
def currentValue = result.body.fields[customFieldName] as Integer
def newValue = currentValue + 1

def newResult = put("/rest/api/2/issue/${issue.key}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header('Content-Type', 'application/json')
.body([
fields:[
customfield_13635: newValue
]
])
.asString()

2 answers

0 votes
cnun August 12, 2022

Hi,

I am getting the same error of the first message. Any additional info about how to solve it?

Thank you

0 votes
Mary Wilson August 30, 2019

Nevermind.  I figured it out.  :-)

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 4, 2019

Hi Mary,

Thank you for confirming that you managed to resolve your issue. 

Could I please ask you to share here the details of what you did to resolve the error, so that other users with the same error can see how to resolve it. 

Regards,

Kristian

Patrick Rach January 24, 2024

Did anyone figure this out?

I’m getting the same error on my post function custom script but it works in the script console:

Screenshot 2024-01-24 at 20.36.01.jpeg.png

Patrick Rach January 25, 2024

Disregard on my previous posting. I was able to solve this by removing the + issue part in my end point for the result variable and use the standard ${issue.key} variable to update the current ticket in question.

Suggest an answer

Log in or Sign up to answer