map = new HashMap<String, String>(); map.put("Stalwarts - ST","ST"); map.put("Pacers - PA","PA"); map.put("Hunters - HU", "HU"); Newproject = ComponentAccessor.getProjectManager().getProjectObjByKey(map.get(customValue)); MutableIssue someMutable = (MutableIssue) event.getIssue; someMutable.setProjectObject(Newproject); someMutable.setProjectId(Newproject.getId()); Long id = ComponentAccessor.getProjectManager().getNextId(Newproject); someMutable.setKey(Newproject.getKey() + "-" + id); someMutable.setIssueTypeId(event.getIssue().getIssueTypeObject().getId()); someMutable.setDescription("something is working"); try{ newIssue = ComponentAccessor.getIssueManager().updateIssue(getThisUser(),someMutable, EventDispatchOption.ISSUE_UPDATED,true); }catch(Exception e){e.printStackTrace()}
well igore the map concept that is auto selected on a custom field selection.. and thats returning right values. just consider that map is returning the Project key according to the custome field value
here:
new project is created.
then mutable issue is created
few setters are called
But only description is getting updated in the issue and nothing else.
i wanted to change the projectObject and issue Key.
please give any idea for my attempt
Community moderators have prevented the ability to post new answers.
Hi Sohil,
Use the IssueService and check your updateValidationResult
https://developer.atlassian.com/display/JIRADEV/Performing+Issue+Operations
i have tried that too before. not working
and with my method i am able to update everything other than projectObject,projectId and issue key..
please suggest some bug in my method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bhushan is correct here - you can't just set the project and key, you need to go through the whole "move issue to new project" process.
That will also force validation on your process and if it's "not working", you'll be told why in the logs.
Also, you've mentioned project and issue key - the other thing that will fail is status...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello @Bhushan & @Nic
Newproject = ComponentAccessor.getProjectManager().getProjectObjByKey(map.get(customValue)); try{ IssueService.IssueResult issueResult= ComponentAccessor.getIssueService().getIssue(getThisUser(),getEvent().getIssue().getKey()); MutableIssue mutableIssue = (MutableIssue) event.getIssue(); mutableIssue.setProjectId(Newproject.getId()); Long id = ComponentAccessor.getProjectManager().getNextId(Newproject); mutableIssue.setKey(Newproject+"-"+id); mutableIssue.setSummary("mutableIssue.setSummary some SUEMM "+mutableIssue.getKey()); IssueInputParameters issueInputParameters = ComponentAccessor.getIssueService().newIssueInputParameters(); issueInputParameters.setProjectId(Newproject.getId()); issueInputParameters.setComment("issueInputParameters.setComment new comment"); issueInputParameters.setIssueTypeId(getEvent().getIssue().getIssueTypeObject().getId()); //issueInputParameters.setSummary("This is a summary"); issueInputParameters.setDescription("describing in issueInputParameters.setDescription"); IssueService.UpdateValidationResult updateValidationResult = ComponentAccessor.getIssueService().validateUpdate(getThisUser(),getEvent().getIssue().getId(),issueInputParameters); ComponentAccessor.getIssueService().update(getThisUser(),updateValidationResult,EventDispatchOption.DO_NOT_DISPATCH,false); }catch(Exception e){e.printStackTrace();}
IssueService is working well and faster but it is not providing me the IssueKey update setter.
I think its the my way i was doing before may work (code in the question). MutableIssue has a IssueKey setter.
Can you tell me even if the MutableIssue object has the setter for issue key and project object and project id as well, still its not reflecting the db and the ui. well I have checked the updated value programatacally of issue key it is showing me the updated value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure you've understood what we've said. You're still trying to "update" an issue. This does not work because you really need to "move" the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
M sorry @Nic.
My requirenment is to move an issue programatically, on a custom field selection. Is there any solution for that.
or it can only be done by the UI "move issue to new project" ?
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.
Hello @Bhushan please look at this question related to the same question above.
https://answers.atlassian.com/questions/173760/update-function-not-working
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.