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

Trying to create New-JiraIssue with customfield #56

Closed
z0ph opened this issue Oct 19, 2016 · 3 comments
Closed

Trying to create New-JiraIssue with customfield #56

z0ph opened this issue Oct 19, 2016 · 3 comments

Comments

@z0ph
Copy link

z0ph commented Oct 19, 2016

Hello,

New-JiraIssue -Project SSC -IssueType Incident -Priority 1 -Reporter 'Lucie' -Summary 'Test issue from PowerShell' -Description 'This is a test issue created from the PSJira module in PowerShell.' -Fields @{
    'customfield_10482'='10413';
}

WARNING: JIRA returned HTTP error 400 - BadRequest
Resolve-JiraError : Jira encountered an error: [customfield_10482] - Could not find valid 'id' or 'value' in the Parent
Option object.

and without custom field :

WARNING: JIRA returned HTTP error 400 - BadRequest
Resolve-JiraError : Jira encountered an error: [Service_Support is required.]

Its a multi select item : When i run :

Get-JiraIssueCreateMetadata -Project SSC -IssueType Incident

Id : customfield_10482
Name : Service_Support
Schema : @{type=option; custom=com.atlassian.jira.plugin.system.customfieldtypes:select; customId=10482}
HasDefaultValue : False
Required : False
AllowedValues : {@{self=http://jira:8080/rest/api/2/customFieldOption/10414; value=Cellule Metier; id=10414},
@{self=http://jira:8080/rest/api/2/customFieldOption/10610; value=Cellule BI; id=10610},
@{self=http://jira:8080/rest/api/2/customFieldOption/10413; value=Service Client; id=10413},
@{self=http://jira:8080/rest/api/2/customFieldOption/10415; value=Cellule Infrastructure; id=10415}}
Operations : set

Could you help how to select this particular value with customfields.

Thanks for your help,

@replicaJunction
Copy link
Collaborator

Hey @z0ph, thanks for the great information on this issue!

Fields like this one with a list of allowed values need a slightly different syntax. I'm working off the top of my head (don't have access to my JIRA instance while I'm at work), but try this:

$field = @{
    'customfield_10482' = @{
        id = 10413
        # You *might* also be able to do this with value = "Service Client" instead...not sure on that one
    }
}

New-JiraIssue -Project SSC -IssueType Incident -Priority 1 -Reporter 'Lucie' -Summary 'Test issue from PowerShell' -Description 'This is a test issue created from the PSJira module in PowerShell.' -Fields $field

Let me know how that goes!

@z0ph
Copy link
Author

z0ph commented Oct 19, 2016

BOOM !

Thanks @replicaJunction its working with your code. Only added quotes :)

id = '10413'

@replicaJunction
Copy link
Collaborator

Awesome! Documentation is on my to-do list (#51) so I'll make a point of including this bit on custom fields as well.

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