Customfield Rendering on issue details view screen

jira-developers
jira-plugin
jira-server

#1

Hello All,
I’m trying create a new custom field in JIRA. My intention is to modify the name of the field depending on the value. I’m using Javascript to render the new name of the custom field on customfield view screen.
I did achieve it using JavaScript. But, I noticed that when my script is executed, it displays the original name for a micro second and then update to the new name.
Here is the script which I’m using, I would really appreciate if you can provide me with any advice on changing my script to overcome this display lag.
I noticed that this issue occurs only when I refresh the issue details page.

#set($nameofthefield = $value)
#set($actualname = $customField.name)
#set($fieldid = $customField.id)

#if ($value)
    $value
#end

<script type="text/javascript">

AJS.$(function() {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
var cf = "$fieldid";
var cfid = "#rowFor" + cf;
if (AJS.$(String(cfid)).length) {
var actualname = "${actualname}";
                                      console.log("Actual Name:" + actualname);
                                      var CFname = "${nameofthefield}"
                                      
                                      var mainnode = AJS.$(String(cfid));
                                      console.log(mainnode);

                                      var children = mainnode[0].childNodes;
                                      console.log(children);

                                      var res = children[1].childNodes[1];
                                      console.log(res);
                                      res.innerHTML = CFname+":";
}
});

How to pass multiple parameters to jira custom service?
#2

Hi,
I have been similiar problem. But in my case I tried to hidden the panel of “traceability”. I used JS to set “dysplay:none”. After I changed of some field, JIRA updated other fields and showed “traceability” again.
I resolved it just parent.removeChild(“traceability”).

You may try JS to set wrong ID of the field. And JIRA will not be able to find/update field.


#3

@jkirankumar1993 are you using custom field type from jira fields, or creating your custom type?


#5

Yes, he is using custom field type


#6

I am using selectCF custom field type. Thanks.


#7

I didn’t understand.


#8

I mean

document.getElementById('myCF').id = 'myCFb';

And after that JIra cannot find of the element.