Scrip runner - Fast-track transition an issue not working properly

Tarun Sapra Community Champion Mar 04, 2014

Hi,

I am using the post function built in script "Fast-track transition an issue" but things don't seems to be working fine -

I haven't given any condition so it should work and the transition is taking place in the backgroud i.e. on UI I don't see the new status, it's still the name and icon of the old status but the transition buttons on the UI are in sync with the fact as if the transition has actually taken place.

Also I am trying to set comment and resolution but thats also not working -

issueInputParameters.setComment('Some comment')

issueInputParameters.setResolutionId('5')

This post function is on the create transition and I am using JIRA 5.2.11.

Thanks,

2 answers

1 accepted

This widget could not be displayed.
Henning Tietgens Community Champion Mar 05, 2014

Make sure it's the last postfunction in the list of postfunctions.

Tarun Sapra Community Champion Mar 05, 2014

Hi @henning, Thanks, putting it in the end worked.

But still I am not able to update the resolution or description, this is the code snippet I have added in the "Additional Code" Section

issueInputParameters.setResolutionId('5')

issueInputParameters.setDescription("I am a description");

Henning Tietgens Community Champion Mar 05, 2014

Technically it has to be after the reindex because otherwise the reindex could take place after the fast track transition but with the issue data before the transition.

Try to add issueInputParameters.setSkipScreenCheck(true) to the additional code, maybe your transition screen doesn't contain description and resolution fields?

Tarun Sapra Community Champion Mar 05, 2014

Hi Henning,

First of all, thanks for sharing this fact regardin- if the fields aren't on screen then we have to use skipScreenCheck. I didn't know this fact as it isn't written on the script runner page where fast track transition info is give. But even after adding it I can't seems to update the description or the resolution - here's the code snippet

log.setLevel(org.apache.log4j.Level.DEBUG);
issue.setResolutionId('5');
issue.setDescription("I am a description");
issueInputParameters.setSkipScreenCheck(true);
log.debug(issue.getDescription()) ;

I can see in the logs the o/p of log.debug printed as "I am a description" but on the actual issue the description which I enter "test" while creating the issue still persists.

In the above code I tried with both

issue.setResolutionId('5'); and issueInputParameters.setResolutionId('5');

Both don't seems to work. Shall I re-index my test instance?

Tarun, did you get this to work?

I've build a listener that I can't seem to get to work. I'm getting odd behavior, such as: Issue shows Open with a resolution of Completed/Fixed (but the History of the issue shows that it changed from Open->Closed and from blank->Completed/Fixed. Reindexing does not make it work.

Also, if I withold the setResolutionId, I get a Closed issue with an Unresolved resolution.

Finally, I have tried doing 2 listeners: 1 to handle the Resolve Issue action and the other to handle the Close Issue action. This scenario does not work either.

All I want is the Issue with a certain summary (my condition) to, upon creation, set resolution to Completed/Fixed (1), status to Closed (6) and add a comment saying it was automatically fast-tracked.

Thanks.

Tarun Sapra Community Champion Mar 18, 2014

Hi Jorge,

I think the steps that your doing are fine, but with script runner I have faced an issue which is if you do to many things, then it might show odd behaviour as it's a open-source plugin and some of the features might not be well tested for all scenarios.

As you have specified -

All I want is the Issue with a certain summary (my condition) to, upon creation, set resolution to Completed/Fixed (1), status to Closed (6) and add a comment saying it was automatically fast-tracked

I would suggest you to write a simple script in the post function to do all of the above instead of relying on fast tracking an issue. The Mutable issue API contains everything for setting commet / resolution and for the status part only and only use workflowutil other-wise data might get corrupted see here -

https://answers.atlassian.com/questions/116537/proper-way-to-change-issue-status-in-code

Mutableissue - https://developer.atlassian.com/static/javadoc/jira/5.0.5/reference/com/atlassian/jira/issue/MutableIssue.html

right way to perform issueoperations - IssueService-

https://developer.atlassian.com/display/JIRADEV/Performing+Issue+Operations

Thank you for the guidance Tarun. It looks that I will have to do exactly as you suggested.

Thanks again!

This widget could not be displayed.

Hi, Tarun,

I tried to do the same thing: adding a fast-track transition post function for transition from Create to New, leaving the condition empty so it's always true, and set action to 'Create(1)', add addtional code setComment. But nothing happened. I've already moved it to the end of all post functions. Do you know why?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

269 views 5 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you