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

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

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.

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.

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.

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?

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.

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

Hi Dipti,

Sorry I should edit my question,

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

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

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 ?

@Dipti Ranjan Behera

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

Hi,

Here is a detailed doc about change history, read this

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

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 7 hours ago in United States

Atlassian Government Symposium

Good day members, Not sure if you are aware that Atlassian will be hosting a Government Symposium on May 1st, 2019 in Washington DC. For more details please click here If you have any questions...

13 views 0 0
View post

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you