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

Create Jira-Issue with multiple customfileds #388

Closed
TimonsElsa opened this issue Nov 7, 2019 · 4 comments
Closed

Create Jira-Issue with multiple customfileds #388

TimonsElsa opened this issue Nov 7, 2019 · 4 comments

Comments

@TimonsElsa
Copy link

TimonsElsa commented Nov 7, 2019

Hello,

im trying to create a jira issue with two custom fields.
First I tried that, but it failed: Operation value must be a string Could not find valid 'id' or 'value' in the Parent Option object.

$phone = @{
       'customfield_12000' = @{ 
       value = '100000'
       }
}

$field = @{
    'customfield_11102' = @{
        id = 11700
    }
}

Get-JiraField -Field "customfield_11102"
New-JiraIssue -project "SERVICE" -IssueType Support -Summary Test -Priority 2 -Description "Test with PS" -Fields $field, $phone

Next i tried the example from "https://psjira.readthedocs.io/en/latest/custom_fields.html", but it failed with:
Invoke-JiraMethod
customfield_12000
Operation value must be a string

$fields = @{
    customfield_12000 = @{
        value = "100000"
    }
    customfield_11102 = @{
        id = '11700'
    }
}

New-JiraIssue -project "SERVICE" -IssueType bug -Summary Test -Priority 2 -Description "Test with PS" -Fields $fields`

Can anyone tell me the right way to create the issue correctly with multiple customfileds? Later i want to mix more customfileds with values and id's to create more accurate Tickets.

Thx for help guys!

@lipkau
Copy link
Member

lipkau commented Nov 8, 2019

thank you for calling my attention to the readthedocs page.
I deleted it, as it has been outdated for over 2 years.
This is the correct documentation page: https://atlassianps.org/docs/JiraPS/

Your ticket does not describe what kind of field it is that you are trying to change. But based on the error you described

Operation value must be a string Could not find valid 'id' or 'value' in the Parent Option object.

I would assume that one of the two fields is a child of the other. If that is the case, this is the correct way to change the value of the field:
https://atlassianps.org/docs/JiraPS/about/custom-fields.html#cascading-picker

if that is not the case, please describe what those two fields are. You can use

Get-JiraField customfield_12000 , customfield_11102

@TimonsElsa
Copy link
Author

TimonsElsa commented Nov 8, 2019

Hello @lipkau ,

thank you for the link to the documentation!

The fields i want to change are two different fields, which must be filled to create the Ticket. It is the Phone number of the User and the "Department".

i hope i can describe it correctly -> its like the issue here: #56

PS C:\WINDOWS\system32> Get-JiraField customfield_12000 , customfield_11102

ID          : customfield_12000
Searchable  : True
Schema      : @{type=string; custom=com.atlassian.jira.plugin.system.customfieldtypes:textfield; customId=12000}
Name        : Phone
Custom      : True
Navigable   : True
Orderable   : True
ClauseNames : {cf[12000], Phone}

ID          : customfield_11102
Searchable  : True
Schema      : @{type=option; custom=com.atlassian.jira.plugin.system.customfieldtypes:select; customId=11102}
Name        : Department
Custom      : True
Navigable   : True
Orderable   : True
ClauseNames : {cf[11102], Department}

Regards

@lipkau
Copy link
Member

lipkau commented Nov 12, 2019

try this:

$fields = @{
    customfield_12000 = "100000"
    customfield_11102 = @{
        id = '11700'
    }
}

New-JiraIssue -project "SERVICE" -IssueType bug -Summary Test -Priority 2 -Description "Test with PS" -Fields $fields`

@TimonsElsa
Copy link
Author

Wonderfully it works as desired. Sometimes you just do not see the mistake. Thank you for your patience and help

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

2 participants