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; } });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.