-
-
Notifications
You must be signed in to change notification settings - Fork 471
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 do I handle a custom field that is an object instead of a simple string? #608
Comments
Ah, ok. Looks like I'm out of luck for now, as this is something that is planned for v2 in #477 |
You can use the methods on Alternatively, you could use https://github.com/mitchellh/mapstructure to decode Or you can process |
I need to go the other direction... I need to encode the value to send to JIRA. I'll look into modifying It would still be easier than trying to create a giant |
Then you should still be able to use |
Or you can use https://github.com/mitchellh/mapstructure to "decode" your custom field structs into |
I tried this, but apparently go-jira is trying to marshall it again... or something customFields := tcontainer.MarshalMap{}
...
data, err := json.Marshal(option)
if err != nil {
return fmt.Errorf(err.Error())
}
customFields["customfield_17100"] = data
...
if len(customFields) > 0 {
i.Fields.Unknowns = customFields
} |
Why not just (untested):
|
... you know how sometimes you're just too close, and need to take a step back, just to realize the obvious? You are correct - that worked. Thank you. :-) |
Thanks for the good collaboration here :) |
They're constantly adding custom fields to JIRA where I work. One of the latest requires a full object rather than a simple string, as the data. It represents a drop-down field with fixed selections.
Here's what the JSON looks like:
Setting a regular customfield doesn't work, since it only allows strings for the values, not objects. If the JSON is pass as a string, it doesn't count as a object.
The text was updated successfully, but these errors were encountered: