Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set fixVersion via Groovy

e
Contributor
February 16, 2014

Hi!

I am doing a post function. I need to clear fixVersions field when my resolution is not 'Fixed'.

Please, advise.

1 answer

0 votes
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 16, 2014
Joel
Contributor
November 2, 2020

This code is really heavy handed to update the fixversion field. I looked up and found Issue.setFixVersions([V]); approach. Is this deprecated? 

Its a lot cleaner than the above answer but does not seem to work.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 2, 2020

It's not saved your way.

Currently I would suggest to use IssueService.update(), a minimal version would be like this:

issueService = ComponentAccessor.issueService
def iip = issueService.newIssueInputParameters()
iip.setFixVersionIds(version.id)
def valRes = issueService.validateUpdate(user, issue.id, iip)
if (valRes.isValid()) {
    issueService.update(user, valRes)
}

Of course this is without error handling etc.

Best regards,
Henning

Like Joel likes this
Joel
Contributor
November 3, 2020

Thank you Henning! I'll give it a shot.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery learning path, product discovery training, idea prioritization, align stakeholders, discovery to delivery, product collaboration, atlassian learning, dev process, roadmap planning, insight capture, team alignment

Elevate Your Skills with Jira Product Discovery!

Unlock your potential and learn how to use Jira Product Discovery to your advantage. You’ll have the expertise to revolutionize ideas and insights, roadmapping, engage and align teams and stakeholders, and deliver the best solutions—faster. Enroll today!

Start Learning
AUG Leaders

Atlassian Community Events