go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.66k stars 323 forks source link

ERROR epiclink: Field 'epiclink' cannot be set. It is not on the appropriate screen, or unknown. #457

Open kenot opened 2 years ago

kenot commented 2 years ago

Hello,

I tried to add field for epic link in the create template, as below:

{{/* create template */ -}}
fields:
  project:
    key: {{ or .overrides.project "" }}
  duedate: {{ or .overrides.duedate "" }}
  issuetype:
    name: {{ or .overrides.issuetype "" }}
  epiclink: {{ or .overrides.epiclink "" }}
  summary: >-
    {{ or .overrides.summary "" }}{{if .meta.fields.priority.allowedValues}}
  priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
    name: {{ or .overrides.priority ""}}{{end}}{{if .meta.fields.components.allowedValues}}
  labels: # Values: {{ range .meta.fields.labels.allowedValues }}{{.name}}, {{end}}{{ range split "," (or .overrides.labels "")}}
    - {{ . }}{{end}}
  components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{ range split "," (or .overrides.components "")}}
    - name: {{ . }}{{end}}{{end}}
  description: |~
    {{ or .overrides.description "" | indent 4 }}{{if .meta.fields.assignee}}
  assignee:
    name: {{ or .overrides.assignee "" }}{{end}}{{if .meta.fields.reporter}}
  reporter:
    name: {{ or .overrides.reporter .overrides.login }}{{end}}{{if .meta.fields.customfield_10110}}
  # watchers
  customfield_10110: {{ range split "," (or .overrides.watchers "")}}
    - name: {{.}}{{end}}
    - name:{{end}}

And when I tried to generate the ticket with the command:

# jira create --noedit -i Task -o summary="Test" -o duedate="2022-04-14" -o labels="Label1 , Label2" -o epiclink="General Admin" -o components="Airflow , WebSSU" -o description="Testing go-jira" -o assignee="toncho.dinkov"

I get the error: ERROR epiclink: Field 'epiclink' cannot be set. It is not on the appropriate screen, or unknown.

Any help would be appreciated.

igbanam commented 1 year ago

Most times, with JIRA epics, the field could be a custom field. Adding it to the template would mean you add the custom field to the template. Confirm this with the schema on your JIRA server.

To solve this, I currently do this in two steps:

  1. Create the JIRA ticket with jira create ...
  2. Add the created JIRA-TKT to the JIRA-EPIC using jira epic add JIRA-EPIC JIRA-TKT

 

p.s: You may also want to do the same thing for labels with jira labels add ...

igbanam commented 1 year ago

Ctrl-F for options.epic in https://github.com/go-jira/jira/issues/455#issue-1088793535 to see an example