Custom URL field with title?

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

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

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.

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.

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

  

 

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.
// &lt;a href="https://secure.server.com/someDir/AgainDir/document"&gt;DOCUMENT_TITLE&lt;/a&gt;
 
// 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;

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 2 hours ago in Europe

Topic Tuesday: Pizza Toppings

Today we're off to Canary Wharf for our next event at Moody's  Investors Service, so I hope you can all make it. Please RSVP here if you can: https://aug.atlassian.com/events/deta...

11 views 0 0
View post

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