HTML tags on field descriptions not working on JIRA 6?

I used to put HTML tags on many custom field descriptions on JIRA 5 with no problem whatsoever, they always worked like what's described in here:

https://confluence.atlassian.com/display/JIRA/Displaying+a+Field+Based+on+Another+Field+Selection

However, when I upgraded to JIRA 6.1, the tags are not changing anything on the page. Insteadm they just show up in the description as raw HTML code. On the page's source code, the tags are shown as, e.g., </script>. And I can't seem to find any documentation stating specifically that HTML on field descriptions are not supported anymore. Are they really not supported, or is something wrong with my JIRA?

3 answers

1 accepted

2 votes
Accepted answer
Henning Tietgens Community Champion Nov 05, 2013

AFAIK, from JIRA 6 on plugin custom fields are not allowed anymore to support HTML in the description for security reasons. It's only supported by the system fields and standard custom fields already provided by JIRA. (Reference: https://jira.atlassian.com/browse/JRA-28776)

That's exactly the problem, thank you. Kind of saddened by this, but it's no use complaining, as I see.

Hi,

Just reading this thread, as I had the same problem as the first person.

What I just found out is that this is shit.... So any changes made to the field description in the "Custom Fields" screen is not translated to any of the "Field Configurations". So for every change made to a custom field, this change has to be made manually to every Field Configuration that uses this field.

Wow, that really sucks Atlassian...

Henning Tietgens Community Champion Mar 06, 2014

I'm using a script (using script runner plugin) for populating all field configurations (and the field itself) with a new description. If someone is interested I could post it here.

Henning,

I would appreciate getting a look at your script. Code examples go a long way toward helping me understand the intricacies of an implementation. Thank you for your time.

Sincerely,

Paul

Henning Tietgens Community Champion Mar 27, 2014

Attached UpdateCustomfieldDescription.txt.

Hi.

Are you able to share again how you managed to use scriptrunner to add the HTML description to a JIRA customfield?

Thanks,

Gaj

Henning Tietgens Community Champion Jan 16, 2017

Here you go...

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.exception.DataAccessException
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.fields.layout.field.*

def cfName = 'Inhouse Customer'
def cfDesc = ''
FieldLayoutManager fieldLayoutManager = ComponentAccessor.getFieldLayoutManager()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
// get all existing FieldLayouts
List<FieldLayoutScheme>	fieldLayoutSchemes =  fieldLayoutManager.getFieldLayoutSchemes()
List<Long> fieldLayoutIds = []
fieldLayoutSchemes.each{ fieldLayoutScheme ->
    Collection<FieldLayoutSchemeEntity> fieldLayoutSchemeEntities = fieldLayoutScheme.getEntities()
    fieldLayoutSchemeEntities.each{ fieldLayoutSchemeEntitiy ->
        fieldLayoutIds << fieldLayoutSchemeEntitiy.getFieldLayoutId()
    }
}
fieldLayoutIds = fieldLayoutIds.unique()
List<FieldLayout> fieldLayouts = fieldLayoutIds.collect{Long fieldLayoutId -> fieldLayoutManager.getFieldLayout(fieldLayoutId as Long)}
// get custom field
CustomField cfObj = customFieldManager.getCustomFieldObjectByName(cfName)
// change description
fieldLayouts.each{fieldLayout ->
    FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(cfObj)
    if (fieldLayoutItem) {
        try {
            if (!fieldLayout.isDefault()) {
                def efl = fieldLayoutManager.getEditableFieldLayout(fieldLayoutItem.getFieldLayout().getId())
                efl.setDescription(fieldLayoutItem, cfDesc)
                fieldLayoutManager.storeEditableFieldLayout(efl)
            } else {
                def efdl = fieldLayoutManager.getEditableDefaultFieldLayout()
                efdl.setDescription(fieldLayoutItem, cfDesc)
                fieldLayoutManager.storeEditableDefaultFieldLayout(efdl)
            }
        }
        catch (DataAccessException e) {
            log.error "$e"
        }
    }
}
fieldLayoutManager.refresh()

Henning

Thank you. Is this in behaviours or scripted field you added as?

Henning Tietgens Community Champion Jan 16, 2017

You have to adapt cfName and cfDesc and than run it in the script console (after testing it in a test environment).

you can try with following script

<script type="text/javascript">  
jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {				
				showHideFieldFunction();
			});
			showHideFieldFunction();
			
function showHideFieldFunction(){
			showHideField();
//select list
			$('#customfield_10933').change(function() {		
				showHideField();
			});	
}

function showHideField(){
	var selectListSelectedValue=$("#customfield_10933 option:selected").text();
	if(selectListSelectedValue == 'Yes'){
	//Text area field
		$('#customfield_10934').closest('div.field-group').show();
	}esle{
		$('#customfield_10934').closest('div.field-group').hide();
	}

}
});
</script>

the above script will work if add it on field description of the custom field in field configuration except in create screen

if you load this script as webresource module in plugin then it will work on create screen also

check this

https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen

I don't think that's the issue here. It's not only scripts that stop working, but any HTML tags at all. Even if I write <b>Something</b>, it will not show up as bold, it'll show the tags just like here.

Besides, if this was the problem, it would already have stopped working on JIRA 5, which was not the case.

we are using <a></a> and <div></div> tags to create help text in jira 6.1 and those are working fine

That's on a field description, I presume. Strange, it doesn't work here at all... Might have something to do with some system configuration, then? I don't know where to look.

can you confirm this, did you added HTML code in field description on field configuration scheme right? and also on which screen you are testing?

I tried both the original description and the field configuration description, both had the same result. I'm supposed to see the description both on the create issue and edit issue screens, but both show raw tags.

can you test as follows,

1. add the HTML content on field description in field configuration scheme

2. refresh the browser

3. check it on other than create screen

i have added <b>Prasad</b> on field description in field configuration, it is showing as bold text

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,769 views 18 21
Read article

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