Should this work in JIRA v6.3.15

This question is in reference to Atlassian Documentation: Setting Priority field value based on customfield value

Should this work in JIRA v6.3.15?

 

4 answers

This widget could not be displayed.

Yes sure you can do it easy. Use Script Runner, JJupin plugin

Any question ? let me know...

I looked at ScriptRunner but I would still need to know the specific structure and fields of the JIR DB.

Where can I learn more about it?

I am trying to map a value from a custom field that is a radio button into a custom field that is a number field

 

This widget could not be displayed.

I tried putting java script in the description field as described but did not get the desired action

This widget could not be displayed.

@Ed Cook It would be helpful if you could provide the javascript that you have used so that others on here can spot any issue with it. One part to carefully check is how you have picked up the customfield id and used that in the javascript.

This widget could not be displayed.

I am trying to have the field "Story Points" set from radio buttons "Level of effort"

I get the id from

mysql> SELECT id FROM customfield WHERE cfname="Level of effort";
+-------+
| id    |
+-------+
| 11053 |
+-------+
1 row in set (0.00 sec)

 

here is the javascript I am trying to use

 

<script type="text/javascript" charset="utf-8" id="storyPointsCustomFieldScript">
function setIssueStoryPoints(e) { // set the value of the story point field here:
if(document.getElementById("customfield_11053_1").checked) { document.getElementById("Story Points").selectedIndex = 1; } else
if(document.getElementById("customfield_11053_2").checked) { document.getElementById("Story Points").selectedIndex = 2; } else
if(document.getElementById("customfield_11053_3").checked) { document.getElementById("Story Points").selectedIndex = 3; } else
if(document.getElementById("customfield_11053_4").checked) { document.getElementById("Story Points").selectedIndex = 4; } else
if(document.getElementById("customfield_11053_5").checked) { document.getElementById("Story Points").selectedIndex = 5; } }
function hideStoryPointsHook() {
var row = document.getElementById("storyPointsFieldArea");
row.style.display = 'none';
AJS.$("#customfield_11053_1").parents('form').submit(setIssueStoryPoints); }
var currentLocation = window.location.href; if (currentLocation.indexOf('CreateIssue') > -1 || currentLocation.indexOf('EditIssue') > -1) {
AJS.$(document).ready(hideStoryPointsHook); }
</script>

One part of this that jumps out at me straight away is 

document.getElementById("Story Points")

where I would expect to see something similar to what you have for the if condition.

document.getElementById("customfield_11053_4")

You are attempting to reference an element by its name not ID.

I was following the example in the FAQ "Setting Priority field value based on custom field value"

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

139 views 1 3
Join discussion

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