Preselecting value from dropdown list based on the user

Tomas Kondelka July 15, 2014

Hi, we have some trouble implementing script that would preselect one value from the dropdown list in case specific user is logged in.

Tried placing our script into several places in jira (description, context description) but seem that neither of them works. Any sugestions how to deal with this one? Scriptfield?

jQuery(document).ready(function($) {
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
        setDefaultValues();
    });
        setDefaultValues();
      
function setDefaultValues(){
        var currentUser=getCurrentUserName();
        if(currentUser=='username'){

document.getElementById("customfield_10860").value = 17202;
           }else{
 alert("test");
        }
}
      setDefaultValues();
function getCurrentUserName() { var user; AJS.$.ajax({ url: "/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } });

1 answer

0 votes
Tomas Kondelka July 16, 2014
No idea anyone?

Suggest an answer

Log in or Sign up to answer