[go: nahoru, domu]

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

unable to set parent field #738

Open
electriquo opened this issue May 1, 2024 · 6 comments
Open

unable to set parent field #738

electriquo opened this issue May 1, 2024 · 6 comments

Comments

@electriquo
Copy link
electriquo commented May 1, 2024

Describe the bug

Creating an issue with parent field or parameter does not work.

$ cat "$file" | jira issue create --type ISSUE --parent $parent --assignee $user --custom parent=$parent --summary "$summary"
✓ Issue created
https://company.atlassian.net/browse/ISSUE-12346

Browsing the issue in the browser, I see that it does not have the parent field. So I tried to analyze the fields of the created issue using the API and as you can see, the parent field was not set.

$ curl -Ls --user "${user}:${token}" https://company.atlassian.net/rest/api/2/issue/ISSUE-12346 | jq -r '.fields.parent'
null

I repeat the analysis on an issue with the parent field set correctly

$ curl -Ls --user "${user}:${token}" https://company.atlassian.net/rest/api/2/issue/ISSUE-12344 | jq -r '.fields.parent'
{
  "id": "119126",
  "key": "ISSUE-12345",
  "self": "https://company.atlassian.net/rest/api/2/issue/119126",
  "fields": {
    "summary": "...",
    "status": {
      "self": "https://company.atlassian.net/rest/api/2/status/10003",
      "description": "...",
      "iconUrl": "https://company.atlassian.net/images/icons/subtask.gif",
      "name": "...",
      "id": "10003",
      "statusCategory": {
        "self": "https://company.atlassian.net/rest/api/2/statuscategory/2",
        "id": 2,
        "key": "new",
        "colorName": "...",
        "name": "To Do"
      }
    },
    "priority": {
      "self": "https://company.atlassian.net/rest/api/2/priority/4",
      "iconUrl": "https://company.atlassian.net/images/icons/priorities/minor.svg",
      "name": "...",
      "id": "1"
    },
    "issuetype": {
      "self": "https://company.atlassian.net/rest/api/2/issuetype/10000",
      "id": "10000",
      "description": "...",
      "iconUrl": "https://company.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium",
      "name": "Epic",
      "subtask": false,
      "avatarId": 10307,
      "hierarchyLevel": 1
    }
  }
}

Clearly, that in the browser I did not set all these values for the parent field. The parent field is a select box to pin an issue that is the parent (some call this an epic), such as selecting ISSUE-12345 (see the screenshot below).

Then I tried to look for the custom field in the CLI configuration

$ dasel -f "${HOME}/.config/.jira/.config.yml" '.issue.fields.custom' | grep -i parent -A 3
- name: Parent Link
  key: customfield_12700
  schema:
    datatype: any

So I tried setting this custom field by editing the issue, but got an error

$ jira issue edit ISSUE-12346 --custom parent-link=ISSUE-12345
? Summary Summary
? Description <Received>
? What's next? Submit

Error:
  - Given parent issue does not belong to appropriate hierarchy.

jira: Received unexpected response '400 Bad Request'.
Please check the parameters you supplied and try again.

Both the parent and the parent-link fields does not apply for the ticket even when the --parent option was used.
How can I set the parent field to value such as ISSUE-12345 using the CLI?
How do I find the parent field type (maybe it has to do something with the configuration, see Caveats at the Additional context below)

Please provide following details

  1. JiraCLI Version:
    (Version="1.5.1", GitCommit="0e0f82d52ef5a775d2cc662fbe38d9732b9b5c59", CommitDate="2024-01-20T10:48:06+00:00", GoVersion="go1.21.5", Compiler="gc", Platform="darwin/arm64")
    
  2. Are you using Jira cloud or on-premise jira server?
    SERVER INFO
    -----------
    
    Version:         1001.0.0-SNAPSHOT
    Build Number:    100252
    Deployment Type: Cloud
    Default Locale:  en_US
    
  3. What operating system are you using? Also mention version.
    ProductName:		macOS
    ProductVersion:		14.4.1
    BuildVersion:		23E224
    
  4. What terminal are you using? Also mention version.
    iTerm 2 Build 3.4.23
    

To Reproduce

See description.

Expected behavior

The parent field to be set and once set, it must be listed in jira epic list <parent issue number>.

Screenshots

This how the parent field look in the browser
2024-05-01_17-27

Additional context

@electriquo electriquo changed the title unable to set custom field unable to set parent field May 1, 2024
@SleepyBrett
Copy link

I'm seeing a similar problem. Except when I try and set the parent I end up with an error - customfield_10014: Field 'customfield_10014' cannot be set. It is not on the appropriate screen, or unknown. which is the custom field for epic.link

epic:
    name: customfield_10011
    link: customfield_10014

@electriquo
Copy link
Author

Maybe @ankitpokhrel has any lead

@jcstorino
Copy link
jcstorino commented Jul 2, 2024

@electriquo @SleepyBrett
Try change Project/Type in config.yml to "next-gen", then the parent is send as field/key struct Instead of Epic custom Field.

@electriquo
Copy link
Author

@jcstorino Although I tried, I couldn't understand what did you mean. Could you please share a concrete example?

@jcstorino
Copy link

@electriquo

Sure...
When you configure jiracli with the init option, a file called config.yml is created in your user folder, to see exact location, type jiracli without parameters and look to -c Flags comment, ex

FLAGS
  -c, --config string    Config file (default is /Users/jcstorino/.config/.jira/.config.yml)

Open this file and look for the project key, below must exist another key with name "type", change its value to "next-gen" and test again the creation of an issue with the --parent option. It worked for me.

project:
    key: TDC
    type: next-gen

@electriquo
Copy link
Author

@jcstorino Thanks. Change from

project:
    key: TDC
    type: classic

to

project:
    key: TDC
    type: next-gen

Will try it later on this week and let your know.

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

No branches or pull requests

3 participants