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

Can't correct assign user as Assignee in plugin

ArtUrlWWW July 15, 2013

Hello.
Can you help me with the simple plugin development?
My plugin's code is here http://pastebin.com/uQtV1T79 - please look at my code.
When event fired, my plugin must set "sogl" user as assignee.
Output of the Tomcat's console is:
first event ("Issue created"):
++++++++++++++++++++++++++++++
1
---++++++++++++++++++++++++++++++
then, my event fired:
++++++++++++++++++++++++++++++
10003
List of users
sogl
END of List of users
++++++++++++++++++++++++++++++
3
---++++++++++++++++++++++++++++++
Issue updated
---++++++++++++++++++++++++++++++

But after this assignee isn't changed: in the issue's field "Assignee: admin" - the old assignee, but in "History" is the

testUser made changes - 9 minutes ago
Field Original Value New Value
Status Open [ 1 ] Согласование 0 [ 10003 ]
testUser made changes - 9 minutes ago
Assignee admin [ admin ] sogl [ sogl ]

Screenshot is attached.

My be after

IssueService issueService = ComponentAccessor.getIssueService();
AssignValidationResult avr = issueService.validateAssign(UserUtils.getUser("testUser"), issue.getId(), uName);
if (avr.isValid()) {
IssueResult updateResult = issueService.assign(UserUtils.getUser("testUser"), avr);

*********

I must re-index issue? How to fix this problem?

P.S.

When fired my event, I have receive e-mail:
testUser assigned TEES-27 to sogl
dsfdsfsdf

Change By: testUser (16/июл/13 4:21 PM)

Assignee: admin sogl

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Alexander Urzhumtsev August 29, 2013

You have to do cast issue from issueEvent. IssueService have other instance issue. For example, this example works in 5.x and I suppose in 6.x too:

Issue issue = issueEvent.getIssue();
if (issue instanceof MutableIssue) {
   MutableIssue mutableIssue =(MutableIssue)issueEvent.getIssue();
   mutableIssue.setAssignee(yourUser);
   ComponentAccessor.getIssueManager().updateIssue(userWhoDoUpdate, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false);
}

0 votes
ArtUrlWWW August 29, 2013
Hi. Latest version.
0 votes
Alexander Urzhumtsev August 29, 2013

What JIRA version do you have?

TAGS
AUG Leaders

Atlassian Community Events