is it possible to empty fix version when resolve issue?

fabby February 13, 2012

is it possible to empty fix version when resolve issue,so that developer has to choose new fix version?

because in some cases,fix version set before resolve is not set correct.develop have to set it to new version.

but some developer often forget to modify the fix version when resolve issue ,even if the fix version choosen is not correct.

5 answers

1 accepted

0 votes
Answer accepted
RambanamP
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.
April 9, 2012

something like

<script type="text/javascript">

var resolvedScreen=document.getElementById('issue-workflow-transition-submit');

if( resolvedScreen !=null && resolvedScreen.value === "ResolvedScreen"){
AJS.$("#fixVersions").get(0).selectedIndex=-1;


}
</script>

make sure the "issue-workflow-transition-submit" and "ResolvedScreen" names are correct by seeing page source

if my answers helped to you give the upvote or accept as answer :)

fabby April 9, 2012

hi prasad,

i'm sorry to ask u again,i can not find the name like "issue-workflow-transition-submit" or "ResolvedScreen".

i can only find the link to "resolve issue screen" on browse issue page by seeing its source code,the link is as follows,

http://127.0.0.1:8079/secure/WorkflowUIDispatcher.jspa?id=10300&amp;action=5&amp;atl_token=BG95-0HJD-8TXN-OKMW|e7cba53b3fe40b46b97a6b569b815f644eeaad5b|lin

RambanamP
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.
April 9, 2012

use firebug to see the source for the popup or form.

"ResolvedScreen" is nothing but the transition name some thing like "Resolved" it is will display as a button.

"issue-workflow-transition-submit" this can find at the "Resolved" button id which can see in source with id tag, i can able to see as it in jira 5.0 but i am not sure in 4.4 because i dont have 4.4 instance on my machine

fabby April 9, 2012

prasad,

thanks very much,

use firebug i can see the popup source code in jira 4.4.1,

with the script i fix the issue

<script type="text/javascript">

var resolvedScreen=document.getElementById('issue-workflow-transition-submit');

if( resolvedScreen !=null && resolvedScreen.value == "Resolve"){

AJS.$("#fixVersions").get(0).selectedIndex=-1;

}

</script>

RambanamP
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.
April 9, 2012

glad to hear it worked..

0 votes
RambanamP
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.
April 5, 2012

Hi Fabby,

do you want to clear the field values? if yes try with following javascript

<script type="text/javascript">
AJS.$("#versions option").each(function() {
AJS.$(this).remove();
});
</script>
use ur field id or name insted of versions
let me know wether it worked for you
fabby April 5, 2012

hi prasad, can u tell me which file shall i add the javascript you show me ?

RambanamP
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.
April 5, 2012

add the javascript in the field descrption in field configuration and you should add condtion to execute this javascript only on resolve screen

fabby April 6, 2012

i add the script

<script type="text/javascript">

AJS.$("#Fix Version/s option").each(function() {

AJS.$(this).remove();

});

</script>

but it still not work.the field Fix Version/s value is still there when edit the issue

RambanamP
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.
April 6, 2012

fabby,

<script type="text/javascript">

jQuery(document).ready(function($) {

AJS.$("# fixVersions option").each(function() {

AJS.$(this).remove();

});

});

</script>

try this with some alerts and check javascript loading or not

Make sure field name is correct

fabby April 8, 2012

parasa,

i create a new field "Test",and add the script above u give me to the field descrption in field configuration

the script is effective,but on "Custom Fields" tab, the field Test just has its name 'test' with no Type ,no Available Context(s) ,no Screens ...

i think it's the script make it.and now how can remove the script form the field descrition in field configuration ?

RambanamP
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.
April 8, 2012

oh..., it's simple. you can edit the field based on position.

when you place a cursor on cutom field edit link it will show you the postion of the field.

wt you have to do is find the position of the field by placing the cursor on edit link before and after the "Test" field, u will get the postion and the edit the any other custom field and change the postion value in url.

it will go to the edit page of Test field then u can remove the Java script

fabby April 8, 2012

prasad,

thanks,i get the field ID of "Test" from mysql ,and then type the link http://localhost:8079/secure/admin/EditCustomFiled!default.jspa?id=10502 .and then succeed remove the js .

1 can you also tell me what's AJS mean? is it the file name "JIRA-HOME/atlassian-jira/includes/ajs"

and " AJS.$(this)." this is the jquery?

2 if i only use $(this) ,it will not make effect.

3 and document.getElementById('Test').innerTEXT seems not work too.

4 if i use

var str=AJS.$("#Test").innerText;

alert(str);

the popup dialog shows "undeifined"

5oh. can u give me examples to write some javascript in jira?

RambanamP
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.
April 8, 2012

1.i am not sure but i think AJS means "Atlassian JavaScript"

and "Test" is a custom field right so you should use custom field id insted of name.

use firebug to see the errors returning by Javascript or to see the exact field names

2. it should work because i tested

3.use document.getElementById('customfield_id')

4.u need to use customfield id

5.http://confluence.atlassian.com/display/JIRACOM/Using+JavaScript+to+Set+Custom+Field+Values

fabby April 8, 2012

hi prasad ,

on page http://confluence.atlassian.com/display/JIRACOM/Using+JavaScript+to+Set+Custom+Field+Values

there is one example :hide some extra fields until a checkbox is ticked:

&lt;script type="text/javascript"&gt;
  checkbox = document.getElementById('customfield_10013_1');
  target = document.getElementById('customfield_10000FieldArea');
  // Hide the target field by default
  target.style.display = 'none';
 
  checkbox.onclick=function() {
    if (checkbox.checked) {
      target.style.display = '';
    } else {
      target.style.display='none';
    }
  };
&lt;/script&gt;

i also want to make the lable BuildNumber hidden,so i rewrite the code

<script type="text/javascript">
  checkbox = document.getElementById('customfield_10101');
  target = document.getElementById('customfield_10100');
  // Hide the target field by default
  target.style.display = 'none';
 $("#customfield_10100").next().css("display","none");

  checkbox.onclick=function() {
    if (checkbox.checked) {
      target.style.display = '';
    } else {
      target.style.display='none';
    }
  };
</script>

i seems does'not work so i modify to AJS.$("#customfield_10100").next().css("display","none");

but the label is still there.

i can hidden label in my test.html :

&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){
  $("p").click(function(){
  $("#rblAbnegateCause_2").next().css("display","none");
  });
});
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;input id="rblAbnegateCause_2" type="radio" name="rblAbnegateCause" value="3" /&gt;
&lt;label for="rblAbnegateCause_2"&gt;something&lt;/label&gt;
&lt;p&gt;If you click on me, I will disappear.&lt;/p&gt;
&lt;/body&gt;

&lt;/html&gt;

what is wrong with my script?

RambanamP
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.
April 8, 2012

did you able to remove the verions? is it worked to you?

coming to your new script to hide fields

can you confirm which version of jira ur using? because the UI changed lot comapre to jira 4.0 to 5.0

fabby April 9, 2012

hi prasad ,

1 the script worked,but it clear all the field's options,what i want is to only clear its selected value,or make it not selecting any options

2 my jira version is 4.4.1

fabby April 9, 2012

prasad,

i have know how to make the field not select any options by :

<script type="text/javascript">

AJS.$("#fixVersions").get(0).selectedIndex=-1;

</script>

and now how can i add condtion to execute this javascript only on resolve screen ?

0 votes
JamieA
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 14, 2012

You should make the field required on the Resolve transition, then use javascript to empty any values, thus forcing the developer to fill them in again.

Seems like this could be a bit annoying though.

fabby February 15, 2012

hi,Jamie

i'am not good at coding,can you tell me which .js file to empty the value,and how ?

fabby April 5, 2012

anyone knows how to use javascript to empty some field values when resovling issue ?

0 votes
ChaiY February 13, 2012

Hi Fabby,

I do not think there is any way to empty the fix version when resolving the issue. You only can achieve it by creating your own plugin which could fully meet your requirement.

What I can think of to prevent the developer setting the fix version incorrectly is to 'only' put the fix version field in the Resolve Issue screen and remove this field from any other screen. This could only allow the developer to set the fix version 'only' when resolving the issue.

Hope this helped!

Sincerely,

Chai Ying

fabby February 13, 2012

yes ,i just do as you say,

but ,some developers choose fix version when resolve issue,but later he find he can't fix the bug on this version.so he has to reopen the bug,and then resolve issue.at this step,he has to change the fix version.

0 votes
Renjith Pillai
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 13, 2012

A pre-condition in the workflow to clear the fixVersion field?

fabby February 13, 2012

does any plugin have this function?

Renjith Pillai
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 13, 2012

Oh sorry, u are looking for pre-condition, i posted the post condition plugin.

Renjith Pillai
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 13, 2012
fabby February 14, 2012

HI,Renjith

do you know any plugin have the pre-condition function??

I'am urgent for this function

Renjith Pillai
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 14, 2012

Sorry fabby, I mistook it as post-function and commented first. Is Chai Ying's suggestion not sufficient? And while reopening the issue, as a post function clear the fixVersion field, so next time the developer resolves the field will be empty and make fixVersion as a mandatory field in field configuration.

Suggest an answer

Log in or Sign up to answer