How to create custom field with URL prefix string?

I would like to add a custom field named "Case" that will be a hyperlink

as follow "Case" <number> as http://mwz/<case Number>

the user will be able to add only case number 
the field will be http://mwz/ + <case Number> 
(System prompt -->)Case:       680103097 (<-- user input)

The user should not be able even accidentally to change the prefix(i.e. http://mwz/).

and will be shown as

Case: http://mwz/680103097           in any JIRA screen

4 answers

Hi Alexander,

I have posted below a code example which shows how you could use a scripted field provided by the Script Runner plugin to take the Case Number out of a number field which stores the Case Number and the to display it in a scripted field called Case which displays the URL. You could always make the Case Number field mandatory which would then mean that you would not need the else clause in the code below.

When setting up the scripted field the must be set to 'HTML' in order to make the returned hyperlink clickable.

// Get the Case Number
def caseNumber = getCustomFieldValue("Case Number") 

// Check if  a case number exists and if so construct and set the Case URL
if (caseNumber != null){
def baseURL ="http://mwz/"
// Construct the HTML hyperlink tag to be returned.
def caseURL = "&lt;a href=" + baseURL + caseNumber.toLong() +"&gt;" + baseURL + caseNumber.toLong() + "&lt;/a&gt;"
    return caseURL
// If no case number exists return a warning message. 
    return "No current case exits"


I hope this helps.


Many Thanks


Hi Alexander, 

you could defina a custom field of type "URL".

There you can set a default value, e.g. http://mwz/xxx"

Your users will only have to replace xxx with a number.

In the custom field configuration you can define a default value, here "Standardwert bearbeiten":

2015-11-16 16_33_40-Benutzerdefiniertes Feld konfigurieren_ URL.png

How to create custom fields, please refer here: documentation

Hope this helps.



I would use a simple scripted validator from Script Runner with a regular expression:

cfValues["Case"] ==~ "http://mwz/[\d+]"


Hi Jamie, I do not have experience in this field. The idea is very attractive. I would be very grateful for a detailed step-by-step guide or any links to similar subject. Thanks, Alex

It's kind of strange that Atlassian never implemented this as an out-of-the-box feature. I've had use cases that would benefit from this since 2005... sad

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

371 views 6 0
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