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.
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
glad to hear it worked..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
add the javascript in the field descrption in field configuration and you should add condtion to execute this javascript only on resolve screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
<script type="text/javascript"> 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'; } }; </script>
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 :
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p").click(function(){ $("#rblAbnegateCause_2").next().css("display","none"); }); }); </script> </head> <body> <input id="rblAbnegateCause_2" type="radio" name="rblAbnegateCause" value="3" /> <label for="rblAbnegateCause_2">something</label> <p>If you click on me, I will disappear.</p> </body> </html>
what is wrong with my script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A pre-condition in the workflow to clear the fixVersion field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh sorry, u are looking for pre-condition, i posted the post condition plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.