go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.67k stars 326 forks source link

issues with custom fields and weird values i can't change. #246

Open liskl opened 5 years ago

liskl commented 5 years ago

trying to figure out how to modify this field but it's $value is strange... `{{- if .meta.fields.customfield_10004 }} sprint:

in the go-jira edit <ISSUE-ID> editor i'm seeing this fields.sprint["value"]: string? `fields: blocker: # Values: them, us,

any idea how i can manipulate the individual values in that value, like editing the value of id or state ?

liskl commented 5 years ago

would love to be able to update any of the internal fields

com.atlassian.greenhopper.service.sprint.Sprint@676abdb3[ id=162 rapidViewId=56 state=ACTIVE name=us 69 goal= startDate=2019-04-29T23:27:58.470Z endDate=2019-05-13T23:27:00.000Z completeDate= sequence=162 ]

mattenklicker commented 5 years ago

The sprint handling seems really crappy in jira (or maybe in this specific setup?). When a jira issue with a sprint is viewed it returns the map from above. When a sprint is set it needs to be the sprint id only. So I changed my view template to

{{if .fields.customfield_10008 -}}
sprints: {{ range .fields.customfield_10008 }}
  - {{ . }} {{end}}
{{end -}}

and the edit template to

{{- if .fields.customfield_10008}}
  customfield_10008: {{ .fields.customfield_10008 | printf "%s" | regReplace ".*id=([0-9]+).*" "$1" }} #sprint id{{else}}
  customfield_10008: #sprint id{{end}}
svenXY commented 4 years ago

For me it was customfield_10220 and to be able to see the sprint names only, I needed:

{{if .fields.customfield_10220 -}}
sprints: {{ range .fields.customfield_10220 }}
  - {{ . | printf "%s" | regReplace ".*name=(.+),startDate.*" "$1" }} {{end}}
{{end -}}