Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,681
Community Members
 
Community Events
184
Community Groups

JiraPs Powershell Module Code error

Edited

I'm attempting to create a new Jira issue using the powershell code below and I keep getting the error at the bottom.  I can't seam to find what I'm doing wrong.  

 

$cred = mycredential

set-jiraconfigserver -Server "https://myserver.atlassian.net"
get-jiraissue -Issue "DEV-251" -Credential $cred

Get-JiraIssueCreateMetadata -Project DEV -IssueType Task -Credential $cred | ? {$_.Required -eq $true}

#customfield_10029 = @{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10231; value=DatabaseQueue; id=10231},
$fields = @{
'components' = (
'Century Distribution Systems, Inc.'
)
'customfield_10029' = (
id=1023
)
}
New-JiraIssue -Project "DEV" -IssueType "Task" -Summary "Test for backup automation" -Description "Test for backup automation" -Reporter "creffner@cds-net.com" -Labels "Maintenance:Refactoring" -Parent "DEV-2062" -Credential $cred -Fields $fields -verbose

error returned:

Invoke-JiraMethod :
components customfield_10029
---------- -----------------
Specify the value for components in an array Specify a valid 'id' or 'name' for Department
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.9.0\JiraPS.psm1:3603 char:27
+ if ($result = Invoke-JiraMethod @parameter) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
+ FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod

 

I can see from the output of get-jiraissuecreatemetadata  that customfield_10029 is the Department field. and I"m using one of the ids that is returned as an allowed value.

Id : customfield_10029
Required : True
AllowedValues : {@{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10228; value=BIOperations; id=10228},
@{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10232; value=DatabaseRelease; id=10232},
@{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10231; value=DatabaseQueue; id=10231},
@{self=https://myserver.atlassian.net/rest/api/2/customFieldOption/10049; value=DataWarehouse; id=10049}...}
Operations : set
HasDefaultValue : False
Name : Department
Schema : @{type=option; custom=com.atlassian.jira.plugin.system.customfieldtypes:select; customId=10029}
key : customfield_10029

 

1 answer

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 14, 2023

Hi @Christopher  - Did you ever get this sorted out? Can you provide what you ended up doing? 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events