Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Announcement banner script not working after Jira upgrade to 9.4.1

Varun Joseph Allu January 5, 2023

Hi Team ,

We have recently upgrade Jira application in our lower instance.
In testing we observed that existing announcement banner script user hide create issue option in Jira is not working.

Below is the script used to hide the create button in announcement banner .

{code:title=Bar.java|borderStyle=solid}

//////////////////////////////////////////////////////////////////////////////////////////////////////
// DON'T ALLOW ISSUES TO BE CREATED FROM 'CREATE ISSUE' WINDOW
//////////////////////////////////////////////////////////////////////////////////////////////////////
function disableProjectsCreateIssue() {

var isCreateIssuePage = AJS.$('#create-issue-dialog').is(':visible');

if (isCreateIssuePage === true) {
var project = AJS.$('#project-field').val();

if ((project == "Ticket (TIC)") || (project == 'External Issue (EXT)') || (project == 'Enterprise Customer Ticket (ECET)') || (project == 'Embedded Customer Internal Ticket (ECIT)') || (project == 'Server Customer Engineering Ticket (SCET)')) {

AJS.$('.issue-setup-fields').css({
border: '0px'
});

AJS.$('.content').hide();
AJS.$('.buttons-container.form-footer > .buttons > .qf-create-another').hide();
AJS.$('.buttons-container.form-footer > .buttons > #create-issue-submit').hide();
AJS.$('.qf-field.qf-field-issuetype.qf-required > .field-group > :not(:last)').hide();
AJS.$('.qf-field.qf-field-issuetype.qf-required > .field-group> .description ').hide();
AJS.$('.qf-field.qf-field-issuetype.qf-required > .field-group ').append('This project is not allowed to create issues.');
}
}
}

{code}

Please help us to fix this issue as it is blocking our upgrade activity.

Thank you,
Varun

2 answers

1 vote
Jan Locaj July 4, 2023

We had a similar problem in our instance.
From JIRA v 9.x the loading of .js resources is being done in defer phase on the following pages:
-Issue View
-Project-centric Issue Navigator
-Global Issue Navigator
-Dashboard (including system dashboard)

For the further details please check:
https://confluence.atlassian.com/jiracore/preparing-for-jira-9-0-1115661092.html#PreparingforJira9.0-app_headerAppheaderupdates:~:text=App%20header%20updates,INCLUDES%20BREAKING%20CHANGES

What helped to us is the following:
We changed the definition of the script tag from:
<script type="text/javascript">...</script>

to:
<script type="module" defer>...</script>

Then our (different than your) inline script started to work as previously did.
Hopefully this helps somehow.

Josh
Contributor
October 16, 2023

This helps on a Jira announcement banner issue.  thanks

1 vote
Nic Brough -Adaptavist-
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.
January 6, 2023

I don't think there's a way to "fix" this.  Atlassian have been removing the ability to inject scripts that might break things like this from most of the places that you could.

Reading your script though, I can also say that you don't need it.  It's a truly terrible way to do what you want, it doesn't do what you need (there's many ways to create issues, your script only blocks one of them), it's ugly (people expect to be able to do things when they click on a link that says they can) and it can be done in Jira without any scripting.

Change the permission scheme for all of the projects you want to prevent issue create in - take away the permission for "create issue".  Users who do not have that permission won't be offered any "create issue" options in the UI, and people doing it via a different route will be told they have no permission to do it.

Suggest an answer

Log in or Sign up to answer