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

[JIRA Plugin] Add attachments from email and update issue change history

Ricardo Joseph
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi All,

Please may I get some assistance.

I am able to add attachments to issues from mail items using the following call:

messageHandlerContext.createAttachment(fileToAttach, fileName, attachment.getContentType(), user, mutableIssue);

However I cannot workout how to update the Issue's change history if the mail item is a response with an attachment added.

Any thoughts?

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi

Read this link carefully, it gives you the answer

https://docs.atlassian.com/jira/5.1.6/com/atlassian/jira/service/util/handler/MessageHandlerContext.html

you should call this IssueUpdater.doUpdate(com.atlassian.jira.issue.util.IssueUpdateBean, boolean)

inorder to change the history of the issue.

Ricardo Joseph
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

I found the below just before I went to lunch:

https://jira.atlassian.com/secure/attachment/29963/AttachFile.java

and with a little reading I found that exact call.

But as you have provided the answer I shall mark this as such.

Thank you for your time.

1 vote
Dipti Ranjan Behera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi Ricardo,

When you create a issue , then no entry gets created in issue history .

but if you update any field through post-function , then the entry goes into the issue while creating it.

After creation of issue only , any updation to issue have their entry in the history.so , attachment will not be reflected in the history.

Since , you are creating the issue through mail no updation will be reflected in history

Ricardo Joseph
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi Dipti,

Sorry I should edit my question,

I need to apply this based on mail responses with attachments...

Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

I think he has the issue and he is creating attachments for that issue.

Dipti Ranjan Behera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi Nitram,

Let me know what wrong i have said that you have downvoted my comment.

the changehistory api only gets history details.(doesnt update history)

@Ricardo,

is the create attachment through mail done by you , a issue update event ?

Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

@Dipti Ranjan Behera

Your logic may be correct but that is not his question, he wants to change the history for an existing issue.

1 vote
Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi,

I dono this is right but you can try this

com.atlassian.jira.issue.changehistory

Issue mutableissue;

mutableissue.changeHistory()

use this method to change it.

Hope this helps.

Ricardo Joseph
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi Nitram,


I do not see that method when viewing the JIRA 5 API.

Could you please provide me with a link in the event I have missed it?

Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

In this link https://docs.atlassian.com/jira/5.0/ search for the package

Package com.atlassian.jira.issue.changehistory

you will be able to fin it out.

Hope this Helps.

0 votes
Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Hi,

Here is a detailed doc about change history, read this

https://developer.atlassian.com/display/JIRADEV/Change+History

Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

What is the object of messageHandlerContext ?

0 votes
Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2013

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events