In my company, I was aksed if can I write a script, that will change status from "Resolved" to "Resolved by customer" if client resolve it.
So I added the needed status and created the script, the script is working correctly, but I think Jira Service Desk is preventing it from changing the status.
What's happening:
Client resolve the issue, so the status is changing to "Resolved". Script listener is picking it up and doing a transition to "Resolved by Customer" status. Then Jira discovers it and its changing status back to "Resolved".
In logs I have this:
WARN [request.CustomerRequestInternalManagerImpl]: The first customer request status found, does not appear to match the actual issues current customer request status. Attempt a re-sort operation before return results
The more odd thing is that, on the issue I see "Resolved" status, in portal in issue details I can see "Resolved" status, but when I go to list of issues, I can see that they have "Resolved by Customer" Status.
Any idea how to baypass it?
I got it working by using Built In script listener called "Fast track transition".
Hi there,
Can you share your script with us? I have written scripts to change issue status before but you have to use a transition you can't do it without using a transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
here are the fragments that do transition, I tried two different approaches, but the result is the same:
def user_object = userManager.getUserByName("dwodzinski") //before I used logged in user, tried to check if my account with admin right do difference
def transitionOptions = new TransitionOptions.Builder()
.skipConditions()
.build()
if(issue.getStatusId() == "5"){
transitionValidationResult = issueService.validateTransition(user_object, issue.id, 1131, new IssueInputParametersImpl(), transitionOptions)
issueService.transition(user_object, transitionValidationResult)
log.error(issue.getStatus().name)
WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class );
workflowTransitionUtil.setIssue(issue);
workflowTransitionUtil.setAction(1121)
workflowTransitionUtil.setUserkey(user_object.getKey())
workflowTransitionUtil.progress()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the script I have used previously to transition is
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueInputParameters = issueService.newIssueInputParameters()
def wpAgreedStatus = 31
def WpIssue = issueManager.getIssueObject("1234")
IssueService.TransitionValidationResult validationResult = issueService.validateTransition(user, WpIssue.id, wpAgreedStatus, issueInputParameters)
if (validationResult.isValid()){
issueService.transition(user, validationResult)
} else {
log.debug("There is an error in the transition for ${WpIssue} errors: ${validationResult.errorCollection.toString()}")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The transition is ok, my script change the status, but Jira change it back,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any progress on this?
* I think what our problems have in common is that we are trying to transition the issue while in a transition - a nested transition of sorts - which i don't think is supported.
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.