URL Encode Jira smart values using %20 instead of + character

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.


Using the urlEncode Jira smart value function, the encoded string replaces spaces (" ") as a plus sign (+) instead of %20. This article provides guidance on how this behavior can be modified to use the expected encoding.


Both + and %20 can represent a space when URL encoding a string, however depending on the position of the encoded string in the URI path, this may break the URL causing HTTP 4xx errors. An example scenario where this encoding would break the URL resulting in an error is with the Opsgenie API Get on calls endpoint. If setting the schedule identifier via a custom field accessed through a smart value, the + will be treated as the character itself as opposed to an encoded blank space:

1 https://api.opsgenie.com/v2/schedules/{{issue.customfield_12345.Name.urlEncode}}_schedule/on-calls?scheduleIdentifierType=name

If the custom field value was "Support Desk", the smart value would render as:

1 https://api.opsgenie.com/v2/schedules/Support+Desk_schedule/on-calls?scheduleIdentifierType=name

The above would return a HTTP 404 error due to the presence of the + character in the URL instead of %20.


This happens due to the smart value function using Java's URLEncoder class, which encodes blank spaces this way. The following feature request was raised to change the default behavior by using a different Java class used for URL encoding smart values:

AUTO-1107 - Use the Java URI Class instead of the Java URLEncode Class with the urlEncode Jira smart value function


Using either the replace() function or replaceAll() function, the + character can be replaced with the expected %20 encoding:


1 {{issue.customfield_12345.Name.urlEncode.replace("+","%20")}}



1 {{issue.customfield_12345.Name.urlEncode.replaceAll("\+","%20")}}

Updated on May 31, 2024

Still need help?

The Atlassian Community is here for you.