how to capture the actual project name when an issue is moved to a new project with issueMoved event?

Hi, I am trying to capture the actual project name with issueMoved event when an issue is moved to new project. In the event method i called the getProjectObject() method to verify the project but it is not giving the actual project object but giving the modified project object. what is the best way to get the details about that the actual project.

thanks in advance!

2 answers

1 accepted

0 votes
Answer accepted

Use ChangeHistoryManager to get the previous issue keys.

Once you get the previous issue key, you can work out the project key from it and retrieve the old project!

Another option is to check the change history. The old project will be there in the change items.

Null value indicates that the issue hasn't been moved yet. For an issue that is moved, you should see the previous issue key.

Hi Jobin,

I am getting null values if i try to work out with the previous issue keys. Even change history is also not giving any information. Kindly advise.


Well, you are trying to get a deleted issue using the previous key. Retrieve the project key from the previous key (anything before the -) and use the project key to get the project.

I mean i got the previous issue keys and if i try to get the project name with that keys, i am getting null values.
Collection<String> keys = changeHistoryManager.getPreviousIssueKeys(issue.getKey());
			for(String key : keys){
				MutableIssue  mu = componentManager.getIssueManager().getIssueObject(key);
				try {
					System.out.println(key+" :: "+mu.getProjectObject().getName());
				} catch (Exception e) {

Did not find a method which takes issue key as parameter that returns a project key and so i tried to fetch a project key in the above way. Could you please let me know the class which is to be used here?

hmm..There is no method that JIRA gives. Try this:

String pKey = key.substring(0, key.indexOf("-"))

Hi Jobin,

I am trying to fetch the the actual values of affects version/s field.

I am using the method changeHistoryManager.getChangeItemsForField(mu,"version"); but it is giving me null.

Could you please let me know the name to be user to fetch the affects version/s values?

or Please suggest if there is other alternative way to fetch the actual values of the affects version/s field.


Are you using mu where mu is th old issue Object? use the new issue object.

Its the new issue object only. So i doubted whether the name("version") i used is correct or not for fetching the affects version/s field information.

Hi Jobin,

I am getting the following exception when i try to persist the actual project details to a custom field

java.lang.ClassCastException: class com.atlassian.jira.issue.customfields.impl.ProjectCFType passed an invalid value of type: class com.atlassian.jira.project.ProjectImpl

Please advise on how to capture the actual project name and version to some custom fields.

Thanks in advance, Srinivas

Srini, Please start a new thread for new discussions.

For Project custom field, you should probably pass the project id and not the Project class.

any ideas please?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in United States

From Atlassian: Confluence Security Advisory - 2019-03-20

Atlassian released a security advisory on 3/20/2019.  The full advisory is here: In a nutshe...

21 views 0 1
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