Skip to content
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

New Issue is not linked to Epic. #282

Open
hugoghx opened this issue Feb 1, 2022 · 13 comments
Open

New Issue is not linked to Epic. #282

hugoghx opened this issue Feb 1, 2022 · 13 comments

Comments

@hugoghx
Copy link

hugoghx commented Feb 1, 2022

Describe the bug
Creating an issue of type "Story" and trying to link that to a parent Epic doesn't seem to work.

  1. JiraCLI Version:
(Version="v0.3.0", GitCommit="", CommitDate="", GoVersion="go1.17.5", Compiler="gc", Platform="darwin/arm64")
  1. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
Jira Cloud - Classic project
  1. What operating system are you using? Also mention version.
macOS Big Sur 11.6.2
  1. What terminal are you using? Also mention version.
iTerm 2 Build 3.4.14

To Reproduce

  1. Ran the command with the -P flag to link to an epic, as specified here. In my case jira issue create -tStory -PMYEPIC-42 [email protected]
  2. Fill in the remaining fields (Summary & Description)
  3. Story is created with the correct summary and description. It's also assigned to me, but not linked to the Epic as seen in the Story detail Epic link - It's set to None.

Expected behavior
Expected the task to be linked to MYEPIC-42.


As an aside, if I set the issue type to Sub-task, it seems to link it to the Epic properly, but the problem is that it doesn't show on the right pane on jira epic view. I tried some other types but none worked.
jira epic view seems to list all issue types linked to an epic but Sub-task.

@hugoghx hugoghx changed the title New Story Issue is not linked to Epic. New Issue is not linked to Epic. Feb 1, 2022
@ankitpokhrel
Copy link
Owner

Hi @hugoamvieira, to confirm you are using next-gen project and not classic right?

@hugoghx
Copy link
Author

hugoghx commented Feb 2, 2022

Hey @ankitpokhrel - Nope, it's a classic project.

As per the config:

project:
  key: <REDACTED>
  type: classic

@ankitpokhrel
Copy link
Owner

Are you able to set epic using jira epic add? Attaching issue on creation seem to be working fine in my setup (cloud) so I might need some extra details to debug. Is this epic shown when you try to add it from the UI ?

@hugoghx
Copy link
Author

hugoghx commented Feb 2, 2022

Are you able to set epic using jira epic add?

Yep. Hadn't tried this but it works like a charm - I created a test Story and added it to an Epic and it worked great :)

Is this epic shown when you try to add it from the UI ?

Yep - I can set the epic in Jira's UI just fine.

@ankitpokhrel
Copy link
Owner

@hugoamvieira this can only happen if the config doesn't have value for epic.link. Could you please check and confirm that the generated config file has valid value for epic section? Please try regenerating the config with jira init if the value is missing.

@ankitpokhrel ankitpokhrel added waiting for response Waiting for users response and removed need to check labels Feb 10, 2022
@hugoghx
Copy link
Author

hugoghx commented Feb 10, 2022

@ankitpokhrel Yep - You're correct. epic.link is set to "".
I tried regenerating but it's still not setting anything in there - What should be in that value?

@ankitpokhrel
Copy link
Owner

epic.link is a custom field and is populated using /rest/api/2/issue/createmeta endpoint. It would be helpful If you can execute following curl command and see if the API returns Epic Link custom field for your project.

curl --request GET \
  --url 'https://<HOST>.atlassian.net/rest/api/2/issue/createmeta?projectKeys=<KEY>&expand=projects.issuetypes.fields' \
  --user "<USER>:$JIRA_API_TOKEN" > createmeta.json

In the response:

  • we are first looking for projects.issuetypes with "name": "Epic" and,
  • in the fields section of that block there should be a custom field with name Epic Link

epic.link is value for that custom field eg customfield_10104

@hugoghx
Copy link
Author

hugoghx commented Feb 14, 2022

Hey @ankitpokhrel - So I found the projects.issuetypes with "name": "Epic", however there's no custom field within it that has name Epic Link.

This custom field is present in other issuetypes though - Here's how it looks like on other issue types:

                        "customfield_10008": {
                            "required": false,
                            "schema": {
                                "type": "any",
                                "custom": "com.pyxis.greenhopper.jira:gh-epic-link",
                                "customId": 10008
                            },
                            "name": "Epic Link",
                            "key": "customfield_10008",
                            "hasDefaultValue": false,
                            "operations": [
                                "set"
                            ]
                        }

I'm still a bit confused into what goes into epic.link VS epic.name as jira init set epic.name to one of those customfield_XXXXXX, and epic.link to nothing.

Thanks!

@ankitpokhrel
Copy link
Owner

@hugoamvieira its strange that the response doesn't have "Epic Link" field for issue type "Epic". Does the issue link on create work if you manually add customfield_10008 to epic.link ?

@hugoghx
Copy link
Author

hugoghx commented Feb 20, 2022

@ankitpokhrel Actually, yep. I set it up like this:

epic:
  name: "customfield_10008"
  link: "customfield_10008"

And it ended up working!

@ankitpokhrel ankitpokhrel added help wanted and removed waiting for response Waiting for users response labels Mar 7, 2022
@PrimordialLight
Copy link

PrimordialLight commented Sep 17, 2022

Hopefull this helps someone. After running Jira Init, this is how my config looked (after changing project type to classic).

board:
    id: 1619
    name: <project_name>
    type: kanban
epic:
    name: customfield_12271
    link: ""
installation: Local
issue:
    fields:
        custom:
            ...
            - name: Epic Link
              key: customfield_12270
              schema:
                datatype: any
            ...
project:
    key: <project_key>
    type: classic
...

The epic.name field had a value of customfield_12271 so I tried setting the epic.link to the same customfield_12271. This didnt work and I got the following error:

- customfield_12271: Field 'customfield_12271' cannot be set. It is not on the appropriate screen, or unknown.

I noticed that the issues.fields.custom.Epic Link had a value of customfield_12270. So I updated my config to following and it worked!

epic:
    name: customfield_12270
    link: customfield_12270

All in all, in order to get my config to work with an on-prem Jira instance, I did the following:

  • Changed project type to classic
  • Updated Epic link to the value of the custom field Epic Link
  • (optional; personal preference) Updated custom fields names to not have spaces: Epic Link --> epic_link

Hope this helps.

@bobobox
Copy link

bobobox commented Oct 13, 2022

Thank you - this fixed it for me.

@SleepyBrett
Copy link

SleepyBrett commented Jun 28, 2024

I'm still having issues linking parents/epics. My epic section looks like this:

epic:
    name: customfield_10011
    link: customfield_10014

but when I set a -P FOO-1111 I get:

Error:
  - customfield_10014: Field 'customfield_10014' cannot be set. It is not on the appropriate screen, or unknown.

Note, I can't just work around this by using add epic after the fact as Parent is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants