Should this work in JIRA v6.3.15

Ed Cook March 9, 2016

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

4 votes
Michael Partyka
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 9, 2016

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

Any question ? let me know...

Ed Cook March 21, 2016

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

 

0 votes
Ed Cook March 10, 2016

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>

Phill Fox
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2016

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.

Ed Cook March 10, 2016

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

0 votes
Phill Fox
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 9, 2016

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

0 votes
Ed Cook March 9, 2016

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

Suggest an answer

Log in or Sign up to answer