I need to update issue using JAVA API.This is only possible via transition id.Please can you put some java code.
Please take a look at:
Example code;
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
Map params = new HashMap();
String comment = "abc"
params.put(IssueFieldConstants.COMMENT, comment);
workflowTransitionUtil.setIssue(issue);
workflowTransitionUtil.setUserkey(userKey);
workflowTransitionUtil.setAction(111);
workflowTransitionUtil.setParams(params);
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since I was on the search myself, I found this solution (tested with Jira 8.3.0 and 8.3.1):
IssueService.IssueResult transResult;
IssueInputParameters issueInputParameters = new IssueInputParametersImpl();
TransitionValidationResult validationResult =
issueService.validateTransition(workflowuser, issue.getId(), actionDescriptor.getId(), issueInputParameters);
if (validationResult.isValid()) {
transResult = issueService.transition(workflowuser, validationResult);
}
What you have to figure out yourself is how to get at the JiraWorkflow. I, for example, extract the List by the following:
Collection<JiraWorkflow> workflows = workflowManager.getActiveWorkflows();
where I iterate all workflows and compare to the searched workflow name. From there on you can go through all actions (.getAllActions()) which give you the transition IDs.
My problem is, and I hope maybe someone else can answer it: How do you make a transition comment?
This:
issueInputParameters.setComment("TestComment");
always gives me the validation error that I'm not permitted to add a comment to this issue, although the workflow user is admin and creator of the actual issue.
Regards
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!
Register todayOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.