How can i create or update issues within a plugin?
i can get all the issues with JQL and i want to update (or also create a new one) some of them, if the data i get from outside are not the same
What kind of plug-in are you developing - Server or Cloud?
For Server you can use the Java APIs - take a look at IssueService. For Cloud you need to use the REST APIs. Let me know if you have a more concrete question.
i am developing for server
i had a look on IssueService and build this code. Am i on the right track?
IssueInputParameters parameters = issueService.newIssueInputParameters(); parameters.setDescription("description"); //example // item.getId() gets the issueId that have to be updated UpdateValidationResult updateResult = issueService.validateUpdate(currUser, new Long(item.getId()), parameters); //updates the issue
Yes, that's the way to do it, you just need to add the actual update invocation:
issueService.update(currUser, updateResult);
The pattern for creating an issue is the same - validateCreate() then create().
thanks a lot, updating is working
but i have some problem creating a new issue.. I add the IssueInputParameters like that, but it do not work:
private IssueInputParameters addParameters(IssueInputParameters par, Long projId) { par.setProjectId(projId); par.setDescription(getDescriptionString(item)); return par; }
have i to do anything else?
It looks like you're new here. Sign in or register to get started.