How do i access custom fields in v3.Issue.Get #209
-
I would expect to find custom fields in How do i access a custom field? |
Beta Was this translation helpful? Give feedback.
Answered by
ctreminiom
Jun 5, 2023
Replies: 1 comment 1 reply
-
Hi @Fank, There're some helpers on the model package that extract the customfield information based on the customfield type issue, response, err := atlassian.Issue.Get(context.Background(), "KP-23", nil, []string{"transitions"})
if err != nil {
log.Fatal(err)
}
fmt.Println(issue.Key)
fmt.Println(response.Status)
options, err := models.ParseMultiSelectCustomField(response.Bytes, "customfield_10046")
if err != nil {
log.Fatal(err)
}
for _, option := range options {
fmt.Println(option.ID, option.Value)
}
cascading, err := models.ParseCascadingSelectCustomField(response.Bytes, "customfield_10045")
if err != nil {
log.Fatal(err)
}
fmt.Println(cascading.Value, cascading.Child.Value)
users, err := models.ParseMultiUserPickerCustomField(response.Bytes, "customfield_10055")
if err != nil {
log.Fatal(err)
}
for _, user := range users {
fmt.Println(user.EmailAddress, user.AccountID)
}
groups, err := models.ParseMultiGroupPickerCustomField(response.Bytes, "customfield_10052")
if err != nil {
log.Fatal(err)
}
for _, group := range groups {
fmt.Println(group.Name)
}
number, err := models.ParseFloatCustomField(response.Bytes, "customfield_10043")
if err != nil {
log.Fatal(err)
}
fmt.Println(number)
sprints, err := models.ParseSprintCustomField(response.Bytes, "customfield_10020")
if err != nil {
log.Fatal(err)
}
for _, sprint := range sprints {
fmt.Println(sprint.ID)
}
labels, err := models.ParseLabelCustomField(response.Bytes, "customfield_10042")
if err != nil {
log.Fatal(err)
}
for _, label := range labels {
fmt.Println(label)
}
versions, err := models.ParseMultiVersionCustomField(response.Bytes, "customfield_10067")
if err != nil {
log.Fatal(err)
}
for _, version := range versions {
fmt.Println(version)
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Fank
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Fank,
There're some helpers on the model package that extract the customfield information based on the customfield type