is it possible to empty fix version when resolve issue?

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

This widget could not be displayed.

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 :)

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

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

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>

glad to hear it worked..

This widget could not be displayed.

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

does any plugin have this function?

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

HI,Renjith

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

I'am urgent for this function

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.

This widget could not be displayed.

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

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.

This widget could not be displayed.

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.

hi,Jamie

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

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

This widget could not be displayed.

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

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

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

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

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

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 ?

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

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?

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

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?

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

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

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 ?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published yesterday in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

141 views 0 9
Read article

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