how to include javascript on create and transition screens only ? because from javascript i am making rest call and loading javascrip as webresource and context as atl.general, due to this javascript will loading in all pages. so i want to restrict javascript load in specific screens.
javascript should be load on create, edit and transition screens only for this,
what contexts need to use??
The following is working for me
var transition=$("#issue-workflow-transition-submit").val(); var editScreen=document.getElementById('edit-issue-submit'); var issueType = AJS.$("#type-val").text(); var issueTypeValue=$.trim(issueType); if((transition=='Update by CCB'||editScreen!=null) && issueTypeValue == 'Defect'){ //code here .. }
Hi @Rambanam Prasad,
I have to add add some javascript to workflow transitions as well,
Where do I have to put this code in the plugin? in atlassian-plugin.xml?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using webresource module we can add javascript, check the following doc for more information
if above link does't help then let me know!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Using the above link I added javascript that runs on atl.general pages.
But I need the JS to run on transition screens,
You have given some solution:
var transition=$("#issue-workflow-transition-submit").val(); var editScreen=document.getElementById('edit-issue-submit'); var issueType = AJS.$("#type-val").text(); var issueTypeValue=$.trim(issueType); if((transition=='Update by CCB'||editScreen!=null) && issueTypeValue == 'Defect'){ //code here .. }
Where am I supposed to add this and how? Could you please tell me I would appreciate that very much.
I want my JS to run on all the issue transition windows for the permissible groups and for all the issue types.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can let the context be atl.general and let your script decide when to execute
for example something similar to the below code :
if((AJS.$("#issue-create")||(AJS.$("#issue-edit")){
//your script
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i am getting "Undefined" message,
i used following code
if(document.getElementById('edit-issue-submit') !=null || document.getElementById('issue-workflow-transition-submit') !=null || document.getElementById('create-issue-submit') !=null || document.getElementById('issue-create-submit') !=null){ //my JavaScript here }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes ur correct, but i am testing by giving just alerts
in transtion screens we can get issueid insted of pid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does your js takes values from the document ? for example document.getElementById("pid") ?
bcoz pid is not available on transition screens . Even i had faced a similar problem, the js was not working on transition screen because i was trying to get pid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes i seen this, but javascript should work on transition screens also :(
for you reference context for create screen is "jira.create.issue" not "jira.issue.create"(it won't work , tested on 5.0.3)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for create issue screen the context should be "jira.issue.create" This is available in 4.4 onwards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.