It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Ricardo Joseph Jul 03, 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

0 votes
Answer accepted
Nitram Jul 03, 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 Jul 03, 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
Nitram Jul 03, 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 Jul 03, 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 Jul 03, 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.

1 vote
Dipti Ranjan Behera Jul 03, 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 Jul 03, 2013

Hi Dipti,

Sorry I should edit my question,

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

Nitram Jul 03, 2013

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

Dipti Ranjan Behera Jul 03, 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 Jul 03, 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.

0 votes
Nitram Jul 03, 2013

Hi,

Here is a detailed doc about change history, read this

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

Nitram Jul 03, 2013

What is the object of messageHandlerContext ?

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Statuspage

⭐️Would you recommend Statuspage? Leave a (honest!) review. ⭐️

Hi Community friends, We're working on sourcing more reviews on Capterra – a popular software review site –  to help teams like yours make more informed decisions when choosing an inc...

77 views 3 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you