Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to clear description field on changing project using Javascript Edited

Hi Team,

I have written Javascript to set default description value for a project as below

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) {

var project = AJS.$('#issue-create-project-name').text();
var projectn = AJS.$('#project').val();

var isCreateIssuePage = AJS.$('#create-issue-dialog').is(':visible');
var itype =AJS.$('#issue-create-issue-type').text();
var issueType = AJS.$('#issuetype-field').val();


if(project == 'Support - Lifecycle Tools' || projectn =='11805'){
//alert('lcsppt')
if (issueType == "Defect" || issueType == "Task" || itype == "Defect" || itype == "Task"){
//alert('itype')
if (isCreateIssuePage == true || AJS.$('#content .aui-page-header-main h1').text() == "Create Issue") {
//('oncreate')


if (document.getElementById("description").value =="") {
//alert('nodesc')

AJS.$("#description").val("<b>Context</b><h3>What is the requested change?</h3> \n <p>&ltdescribe the request here&gt</p> \n<h3>Why is this change needed?</h3> \n <p>&ltdescribe the motivation here&gt</p> \n<h3>What is the impact to existing process, tools, and stakeholders? </h3>(if known): \n <p>&ltdescribe the impact here&gt</p> \n<h3>Steps to perform/reproduce </h3> \n <p> <ol class= olnospace>&ltList the planned activities or steps to reproduce the fault (defects only)&gt</ol></p> \n<h3>Acceptance Criteria </h3> \n <p>&ltList the expected output to be completed before this ticket can be closed&gt </p> ");
}
}
}
}
else{
AJS.$("#description").val("")

}
});

 

When I am changing project,description field value is not getting cleared. Can anyone help me on the same?

1 answer

0 votes
Daniel Ebers Community Leader Nov 21, 2020

Hi Vineela,

unfortunately there is no help under way but more a general hint: customized Java Script many times in the past caused trouble - it is not recommended anymore.

In cloud plans for example it is completely not possible to set it like this.

I saw instances where this was introduced many years ago and now the JS code was remove due to incompatibilities.

More stable it a solution using Behavious but the App needs payment.

Cheers,
Daniel

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you