I need to update issue using JAVA API.This is only possible via transition id.Please can you put some java code.
Hi @Ramesh Lakshmanasamy,
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();
It doesn't work.
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
It looks like you're new here. Sign in or register to get started.