Using scriptrunner's expression for fields with dashes in their name

I'm using scriptrunner's issuefunction expression to compare two custom date fields in a jql. Example: issueFunction in expression("", "dateField1 < dateField2"). I'm having trouble when one of the custom fields have a dash in it, scriptrunner doesn't recognize the name of the field. When a field is called "date field 1", writing datefield1 on scriptrunner works. When a field is called "date - field 1", writing date-field1 on scriptrunner does not work.


Is there a particular way to escape dashes for custom field names in that situation?

1 answer

0 votes
Alexey Matveev Community Champion Nov 21, 2017


Try to write it like this

issueFunction in expression("", "\"date - field 1\" < dateField2")

That seems to result in an "java.lang.ClassCastException: null" error. I also tried it with system fields to make sure it wasn't an issue with the custom fields, the query

issueFunction in expression("", "\"updated\" < created")

results in that error, while if I remove the escaped quotes

issueFunction in expression("", "updated < created")

it works fine, returning zero results without any error.

Alexey Matveev Community Champion Nov 22, 2017

Yep, I guess it treats is as a string not as a field name

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,804 views 11 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot