Cant set custom field singe-select value

Leoš MAREK May 22, 2023

Hello,

Im using JiraPS powershell module to interact with the tickets. I need to set a customfield value, the type is single-select. My syntax is exactly as described in the guide here https://atlassianps.org/docs/JiraPS/about/custom-fields.html


 $field = @{
customfield_17700 = { id = 40409 }
}


or


$field = @{
customfield_17700 = { value = "Myvalue" }
}

But I always get this error:

Invoke-JiraMethod :
customfield_17700
-----------------
Could not find valid 'id' or 'value' in the Parent Option object.
At C:\lm\scripts\jira\lib\JiraPS.psm1:5505 char:21
+ Invoke-JiraMethod @parameter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
+ FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod

 

Any help would be appreciated.

Thanks

2 answers

1 accepted

1 vote
Answer accepted
Leoš MAREK May 22, 2023

Problem solved. Syntax has to be a like this (new hash table inside the field)

$field = @{'customfield_17700' = @{ id = '40410'}}

This is missing in the documentation above.

Cheers Leos

0 votes
Ken McClean
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2023

I haven't used the JiraPS module much, but should you be using dot notation?  In Groovy or Python, I'd expect to have to reference it something like issue.parent.id

Leoš MAREK May 22, 2023

Hi Ken,

if you check the link I provided, it say to use the notation that I use. It works well for text field, like

$field = @{

customfield_17700 = "MyText"

}

However if the field is single-select, I cant update it still. Trying some options, but not successful yet.

Suggest an answer

Log in or Sign up to answer