Custom URL field with title?

K September 24, 2013

I would like to add a custom field that allows me to edit the text displayed, instead of displaying the entire URL.

For example, if I wanted to link to Google, the user-facing text would be "Google" and not "www.google.com"

Is there any way to do this? I found the URL field, but it only shows the full link, and I'd like to give my users some idea of what they're clicking on.

3 answers

0 votes
Per Viberg June 23, 2015

Directly after posting, I realized I answered the wrong question smile

you still need Script Runner and a Scripted Field with HTML template.

the script:

//Simply store the full href and your title in a custom field called Document_Link i.e.
// <a href="https://secure.server.com/someDir/AgainDir/document">DOCUMENT_TITLE</a>
 
// Then create a Scripted Field called Document with this code:
CustomField document_link = customFieldManager.getCustomFieldObjectByName('Document_Link');
 
//get the full href:
doc_href = issue.getCustomFieldValue(document_link);
 
return doc_href;
0 votes
Per Viberg June 23, 2015

Hi,

I used the plug-in Script Runner to achieve this. Add a Scripted Field with Template HTML, then write something similar to this as script:

//store the key to the page/document you want to link to in a custom field called Document_ID
//usually this is some document name or id.
CustomField document_id = customFieldManager.getCustomFieldObjectByName('Document_ID');
 
//calculated and return the full href:
DOCUMENT_ID = issue.getCustomFieldValue(document_id);
return '<a href="https://secure.server.com/someDir/AgainDir/">' + DOCUMENT_ID + '</a>';

 

this will create a clickable field: DOCUMENT_ID without the full href.

there is plenty of documentation about scripted fields on Script Runners page, if this is not enough to get you started.

 

thank <insert divinity of choice> for Script Runner! smile

  

 

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2013

No default field in JIRA can do this. You will have to develop a custom field.

K October 10, 2013

My question was about how to create that custom field. Like I said, I could add a URL field, but the text displayed is the URL, and is not customizable.

Mark Gillespie December 12, 2014

Did anyone find a custom field that does this? We have the same requirement. We have links in our JIRA to reviews and documents in other buisness systems, and sometimes the links are VERRRRRYYYY long, making JIRA look messy. It would be really nice to be able to have the link and the link name.

Suggest an answer

Log in or Sign up to answer