Coder Social home page Coder Social logo

Comments (12)

itaddams avatar itaddams commented on June 8, 2024 1

it should be {field :{"assignee":{"name":"user1"}}}

from jira-client.

bobcarroll avatar bobcarroll commented on June 8, 2024

The error message suggests that assignee is a string and not a dictionary. You would get this result if your JSON looked something like this {"assignee": "user1"} when it should be {"assignee": {"name": "user1"}}. The only way I could see this happening is if the editmeta data coming back from JIRA is wrong.

Can you try this instead?

tempIssue.update().field(Field.ASSIGNEE, Field.valueByName("user1")).execute();

That will force jira-client to send the value as a dictionary in the form of {"name": "user1"} instead of a string.

from jira-client.

v1v avatar v1v commented on June 8, 2024

I'll give a go tomorrow morning and let you know the outcome.

Thanks rcarz

from jira-client.

v1v avatar v1v commented on June 8, 2024
issue.update().field(Field.ASSIGNEE, Field.valueByName("robin")).execute();

Same error, I'm afraid:

400 Bad Request: {"errorMessages":[],"errors":{"assignee":"data was not an object"}}

Let me know if you need further details.
Thanks again

from jira-client.

v1v avatar v1v commented on June 8, 2024

Atlassian JIRA Project Management Software Version: (v6.3.14#6345-sha1:47b2bb0)

from jira-client.

danjee avatar danjee commented on June 8, 2024

Hello,
Thanks for the nice API.
I'm having the same issue when changing the assignee field.
My java code is:

User user = User.get(jira.getRestClient(), assignee);
issue.update().field(Field.ASSIGNEE, user).execute();

Adding a comment or making a transition in a workflow works.
Jira version is JIRA v7.1.1
Any idea?

Thank you

from jira-client.

danjee avatar danjee commented on June 8, 2024

@v1v : did you get around this issue? Thanks

from jira-client.

danjee avatar danjee commented on June 8, 2024

Also with

issue.update().field(Field.ASSIGNEE, Field.valueByName(username)).execute();

gave me the same error.
I will try to put tcpmon between the endpoints to see what goes trough the wire and hopefully see that is only my fault. If I use the jira-client in a standalone test application all goes well. My problem is in a custom jenkins plugin I want to make; when trying to update the assignee from a git comment. Maybe some other jar in the classpath ruins the rest call,even though it's not the case when adding jira comments or transitioning through the workflow.

from jira-client.

bobcarroll avatar bobcarroll commented on June 8, 2024

I was not able to reproduce this, so it would be very helpful to see the results of your capture.

from jira-client.

danjee avatar danjee commented on June 8, 2024

The capture gave me nothing due to some intranet restrictions. I got around it by calling the Jira rest API directly. Maybe the issue is fixed with the changes in this release iteration and not on the Maven central release and that is why you couldn't reproduce it.

from jira-client.

matiasrosemberg avatar matiasrosemberg commented on June 8, 2024

I can't change the ASSIGNEE too,

public void addAsignee(String numticket, String user){
        try {
            System.out.println(jira.getIssue(numticket).getAssignee());
            System.out.println(jira.getIssue(numticket).getField(Field.ASSIGNEE));
            jira.getIssue(numticket).update().field(Field.ASSIGNEE, Field.valueByName(user)).execute(); //THIS LINE DOES NOT WORK
            System.out.println(jira.getIssue(numticket).getAssignee());
        } catch (JiraException e) {
            e.printStackTrace();
        }
    }

net.rcarz.jiraclient.JiraException: Field 'assignee' does not exist or read-only
at net.rcarz.jiraclient.Field.getFieldMetadata(Field.java:432)
at net.rcarz.jiraclient.Field.toJson(Field.java:535)
at net.rcarz.jiraclient.Issue$FluentUpdate.execute(Issue.java:171)
at abm.robot_automation.BotJiraV2.addAsignee(BotJiraV2.java:151)
at abm.robot_automation.App.main(App.java:16)

from jira-client.

imbyungjun avatar imbyungjun commented on June 8, 2024

In my case, Field.ValueTuple was cause of the bug.
In the FluentTransition.realExecute() method, it moves whole the entries in the member variable map fields to the local variable map fieldmap.
When fields contains a value a type of Field.ValueTuple, it doesn't move to fieldmap properly. So the fieldmap contains a entry that key is copied but value is null.

The workaround is passing the value as Map like this.

issue.transition()
    .field(Field.ASSIGNEE, ImmutableMap.of("name", assignee))
    .execute(TRANSITION_ASSIGN_ASSIGNEE);

from jira-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.