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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Null value indicates that the issue hasn't been moved yet. For an issue that is moved, you should see the previous issue key.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
-Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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) { System.out.println(e.toString()); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hmm..There is no method that JIRA gives. Try this:
String pKey = key.substring(0, key.indexOf("-"))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
-Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using mu where mu is th old issue Object? use the new issue object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
any ideas please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.