https://answers.atlassian.com/questions/59501/change-assignee-via-javascript already gives a good solution to set the assignee in a transition via javascript to the current user.
But i need to change the selected assignee to a specific user.
I tried the following code - but somehow it only works when the specific user (setUser) is equal to the current user:
<script type="text/javascript"> (function($) { function setAssignee(){ var setUser = "someusername"; var assigneeSelect = AJS.$("#assignee"); assigneeSelect.trigger('set-selection-value', setUser); } AJS.toInit(function(){ setAssignee(); }) JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { setAssignee(); }); })(AJS.$); </script>
Any idea what i'm doing wrong?
JIRA 5.2
Community moderators have prevented the ability to post new answers.
did you tried like this ?
AJS.$("#assignee").val(setUser);
the following script is working for me(Just now tested)
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { setAssignee(); }); setAssignee(); function setAssignee(){ var setUser = "prasad"; AJS.$("#assignee").val(setUser); } }); </script>
make sure that user is valid in jira and user should have assignable permission
if you are trying do this function on create screen then load this script as webresource module in a plugin, check this
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have updated my answer!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
or else you have a default jira workflow postfunction Update Issue Field.
go to workflow and go to transition and add Update Issue Field postfunction, select Assignee and Value to specific user you want.
hope this helps or revert back if any doubts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know the assignment via postfuctions. We currently use them. But we want to give users more flexibility - therefore we want to prepopulate the field with the user that is normaly the correct user, but give the users the flexibility to choose an other.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.