How to Hide A description for the custom field.

Harish February 14, 2021

I want to hide javascript code when a user creates an issue from the Jira

overview of the issue:
There is a javascript for the custom field, however, the user should not see that when creating the ticket, but the script should be needed in the custom field. 

2 answers

1 vote
Daniel Ebers
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.
February 21, 2021

Hi @Harish

I believe what you are seeing is two-sided:
- the Java Script codes does not work anymore
- the code is displayed to the user instead of being executed.

This all is happening after an upgrade, if so:

HTML support for custom field descriptions has been switched off due to security considerations by default. This was shipped in JRASERVER-70859 (Disallow HTML in custom field descriptions and list item values by default).

Good news is, it is still possible to enable this feature as explained in Configuring Jira application options.

Please see here for further information:

https://confluence.atlassian.com/adminjiraserver087/configuring-jira-application-options-998872637.html

Regards,
Daniel

0 votes
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2021

Hi, @Harish Here's an alternative,

Install Automation for Jira Lite.

Create a separate custom field and when the user creates an issue write an automation rule such that it gets copied over to the field where you have written the javascript code and make the view issue screen non-editable. This will achieve your requirement to an extent but not up to mark for what you have asked.

May I know which plugin you are using for customizing fields?

Thanks,
Pramodh

Harish February 18, 2021

Thanks, Pramodh

 

I'm not using any add-on for this feature I'm using this as a javascript under the custom field description for some reasons after the upgrade to 8.12.1 when i switch the values it's not changing the other custom field values so scratching my head how to get this resolved any thoughts ?

{code}

<script type="text/javascript">

jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
callChangeFunction();
});
callChangeFunction();
function callChangeFunction(){
setFieldValue();
// dropdown custom field change function
$("#customfield_14695").change(function()

{ setFieldValue(); }

);

}
function setFieldValue(){
//drop down field selected value
var dropDownFieldval = $.trim($("#customfield_14695 :selected").text());

if(dropDownFieldval == 'New ECS Request')

{ $("#customfield_14659").val("42"); $("#customfield_14684").val("15922"); }

else

{ $("#customfield_14659").val("05"); $("#customfield_14684").val("15019"); }




}
});

</script>

 

Suggest an answer

Log in or Sign up to answer