Open pH-T opened 3 years ago
Hi! Thank you for taking the time to create your first issue! Really cool to see you here for the first time. Please give us a bit of time to review it.
Hello @pH-T , do you mean how to retrieve them? If so, please have a look to issue_test.go (line 776) https://github.com/andygrunwald/go-jira/blob/master/issue_test.go here you can check how to retrieve and work with custom fields and just below, with complex custom fields
If you are talking about a different opertation please explain and I will try to help you
Best.
Thanks for your fast reply!
Sorry, I was not precise enough... I was wondering how I would create an issue with custom fields.
Should something like this work?
...
u := tcontainer.NewMarshalMap()
u["customField1"] = "customValue"
i := jira.Issue{
Fields: &jira.IssueFields{
Description: "Test Issue from Golang",
Type: jira.IssueType{
Name: "Task",
},
Project: jira.Project{
Key: "TEST",
},
Summary: "Test-Sum",
Unknowns: u,
},
}
client.Issue.Create(&i)
...
I was not able to get this code snipped to run successfully, but this might be because of my local Jira-Testing-Instance...
Yes, I think that is the way, let me bring you some examples from other issues
(Source https://github.com/andygrunwald/go-jira/issues/257#issuecomment-595637698 )
custome["customfield_10209"] = map[string]string{"value": assessment}
i := jira.Issue{
Fields: &jira.IssueFields{
Assignee: &jira.User{
Name: jira_user,
},
Description: utf8toASCII(description),
Type: jira.IssueType{
ID: "10300",
},
Project: jira.Project{
ID: "10308",
},
Summary: utf8toASCII(summary),
Unknowns: custome,
},
}
Also have a look to this post and its resolution: https://github.com/andygrunwald/go-jira/issues/117
Pls let us know if that helps
Thank you, that helps! So I was on the right track... :)
Hey @pH-T and @manuelbcd Thanks for stepping in and solving this issue.
Would one of you mind to create a PR and create a proper example into the documentation/readme/example unit test? This would be great.
Hello @andygrunwald, playing with the project to implement this new test I have noticed that the CreateIssue example (https://github.com/andygrunwald/go-jira/blob/master/examples/create/main.go) is not working with Jira Cloud (equivalent to jira software 8.15.x right now).
The creation method works properly but the return body does not include the "Summary" field so at the end of the example you will get a panic break because Summary var is not initialized.
I'm wondering how to enrich this example, since it is workign with older jira versions but I could add the example... should I add a new example specifying "> v8.x " or do you prefer me to implement it in the same example but branching depending of a constant value for example
(EDIT) You can have a look to this example as "draft" https://github.com/andygrunwald/go-jira/pull/351
Here I have created a new folder for examples related with custom-fields, but I don't know if that is the structure we want for that.
Hey @manuelbcd, thanks for your effort you put in already. I am very limited in time right now to have a deeper look at it. I will need some time to look at it in detail. Please excuse me when it comes to delays here.
Sure @andygrunwald. Meanwhile I can investigate in which particular Jira versions the response was changed (I guess 8.0 but it could be earlier).
Hello @andygrunwald , I have been navigating through Jira API documentation (from v1 to v8) and it is strange because I can't see a POST Issue (creation) response with field values within it, please have a look:
So in short, I can't check why the example https://github.com/andygrunwald/go-jira/blob/master/examples/create/main.go tries to print issue.Fields.Summary from response since it never has been part of the response. My theory is... could it be possible htat Go-Jira in the past had a feature in which Create-Issue was requesting a GET issue implicitly?
Sadly, I don't have the time right now to look into this. @ghostsquad @rbriski @fffinkel @benjivesterby Do you have time to provide some help?
@andygrunwald I forgot to request you to close this isse. I think it is resolved in #358 and #357
Thanks a lot @manuelbcd!
Hello,
I'm trying to produce a report and I'm having some issues accessing custom fields. By going through the errors I managed to get it to work, but I'm having some trouble understanding what I did and why it works, and if there is a better way to do it:
customfield_13705 is a text multiselect field. I want to access all existing teams names, and assign it to auditIssue.Teams which is of type string.
val, _ := jiraIssue.Fields.Unknowns.Value("customfield_13705")
var sliceOfTeams []string
for _, team := range val.([]interface{}) {
sliceOfTeams = append(sliceOfTeams, team.(map[string]interface{})["value"].(string))
}
auditIssue.Teams = strings.Join(sliceOfTeams, ", ")
Hi!
First: thanks for your work here! Its nice to have a Jira API impl. in Go!
I stumbled upon the
Unknowns
struct field ofIssueFields
and thus I think it should be possible (?) to add custom Jira fields - but how? Can you provide an example?Thanks, pH-T