It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Tarun Sapra Community Leader 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

1 vote
Answer accepted
Henning Tietgens Mar 05, 2014

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

Tarun Sapra Community Leader 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 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 Leader 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?

Jorge Rivero Mar 18, 2014

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 Leader 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

Jorge Rivero Mar 18, 2014

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

Thanks again!

0 votes
Tian Lixin Apr 16, 2014

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

1,018 views 13 15
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you