Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update 'Resolution" Field #340

Open
louisbizouerne opened this issue Jul 30, 2019 · 3 comments
Open

How to update 'Resolution" Field #340

louisbizouerne opened this issue Jul 30, 2019 · 3 comments

Comments

@louisbizouerne
Copy link

louisbizouerne commented Jul 30, 2019

Hi,

I am trying the following in order to update the "Resolution" field:

issue=get_issue(issue)
issue.save!("fields" => {"resolution" => {"id" => resolution_id}})

But I am getting following error:
{"errorMessages":[],"errors":{"resolution":"Field 'resolution' cannot be set. It is not on the appropriate screen, or unknown."}}

Any idea how to do that?

Thanks

@Gaidline
Copy link

Any hints how to solve this issue?

@Skipants
Copy link

Here's how I set a resolution when transitioning some issues... however it doesn't seem to work for some types of issues. We have "Bug" and "Task" types and this works for "Task" but not "Bug":

  def self.close_issues(issues)
    # Fix resolution
    close_resolution = JIRAClient.Resolution.all.find { |r| r.name == "Fixed (Done)" }

    issues.each do |issue|
      transition_type = issue.transitions.find { |t| t.name == "Close" }
      issue.transitions.build.save!('transition' => { 'id' => transition_type.id, 'resolution' => close_resolution.id })
    end
  end

@toomanyjoes
Copy link

toomanyjoes commented Oct 16, 2021

Yes @Skipants answer is close but wrong. Below worked for me, issue is the jira ruby issue object that you're trying to change the status of and client, in case it's not obvious, is an instantiated jira ruby client.

wont_do = client.Resolution.all.find { |r| r.name == "Won't Do" }.attrs
issue.transitions.build.save!( 'transition' => { 'id' => transition_id }, 'fields' => { 'resolution' => wont_do })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants