HTML tags on field descriptions not working on JIRA 6?

Guilherme Peres November 4, 2013

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
Answer accepted
Henning Tietgens
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.
November 5, 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)

Guilherme Peres November 5, 2013

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

1 vote
Chris Kent
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.
March 6, 2014

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
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.
March 6, 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.

Paul Jarman March 27, 2014

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
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.
March 27, 2014

Attached UpdateCustomfieldDescription.txt.

G January 16, 2017

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
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.
January 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

G January 16, 2017

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

Henning Tietgens
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.
January 16, 2017

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

0 votes
RambanamP
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.
November 4, 2013

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

Guilherme Peres November 4, 2013

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.

RambanamP
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.
November 4, 2013

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

Guilherme Peres November 4, 2013

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.

RambanamP
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.
November 4, 2013

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?

Guilherme Peres November 4, 2013

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.

RambanamP
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.
November 4, 2013

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