Forums

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

Using Java script to prefill fields on create screen

Sushma Nagaraj September 12, 2018

Hello Team,

I would like to use Java script to prefill custom fields on create screen. I would like to set assignee and other custom fields based on the issue type and another custom field called system. Can you help me as to how this could be done.

The following is what I have tried it detects the change on the custom fields however it does not detect the change as far as issue type is concerned.

 

<script type="text/javascript">
  (function($) {   
    AJS.toInit(function(){
    }); 
$(document.getElementById("customfield_14041")).change(function(){
      //alert the value of the select list
      //alert (($(document.getElementById("customfield_15735")).val()));
     
      switch ($(document.getElementById("customfield_14041")).val()) {
        case "23125":
          AJS.$("#assignee-field").val("ray.pang");
        break;
        default:
          AJS.$("#assignee-field").val("mike.hayes");
      }    });
}
  })(AJS.$);
</script>

 But if I put $(document.getElementById("issuetype-field")).change(function(){ 

It does not work

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events