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+":";
}
});