-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use an array for input to customfields #27
Comments
And to clarify, this is the documentation for Insight and customfields: https://documentation.riada.io/display/ICV50/Insight+with+JIRA+REST-API I finally succeeded updating an issue with JiraPS-module but I would like to stick with your module if possible. |
I am sure the issue is here because I was assuming every value should be a string: Line 175 in 10c29d0
I will need to set up an example and play with it. You may be able to work with the issue object directly for this.
If I can't do direct assignment like that, there is also another method that I may look at
Anyway, the |
The first part don't work, there is no customfield with that name when you read from Jira. I can read the customfied by ID but not by name. With the second part I can set the value, but still get the "Array" issue. > $issue = Get-JIssue -Key ITDR-150
> $issue["Environment"]
Value
-----
Production
> $issue["Responsible Team"]
<empty>
> $issue.customfields.addbyid("customfield_11302", @("CMDB-24"))
Values Id Name
------ -- ----
{Production} customfield_11304 Environment
{CMDB-24} customfield_11302 Responsible Team
> $issue|Save-JIssue
Save-JIssue : System.InvalidOperationException with Save issue [ITDR-150]: [data was not an array]
At line:1 char:6
+ $issue|Save-JIssue
+ ~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Save-JIssue], JiraInvalidActionException
+ FullyQualifiedErrorId : Save issue [ITDR-150],JiraModule.SaveIssue For reference, with JiraPS this is how I can do this as an example: $fields = @{
labels = @("Network", "Security")
customfield_11302 = @(@{ key = "CMDB-8324"})
customfield_11808 = @(@{ key = "CMDB-24"})
}
Set-JiraIssue -Issue ITDR-154 -Fields $fields Finding out the syntax for this took me days. I tried something similar with your module but it didn't work. > $issue.customfields.addbyid("customfield_11808", @(@{"key" = "CMDB-3605"}))
Values Id Name
------ -- ----
{System.Collections.Hashtable} customfield_11808 Function
Save-JIssue : System.InvalidOperationException with Save issue [ITDR-150]: [data was not an array] [data was not an array]
At line:1 char:6
+ $issue|Save-JIssue
+ ~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Save-JIssue], JiraInvalidActionException
+ FullyQualifiedErrorId : Save issue [ITDR-150],JiraModule.SaveIssue Or this: > $issue.customfields.addbyid("customfield_11808", @(@("CMDB-3605")))
Values Id Name
------ -- ----
{Production} customfield_11304 Environment
{CMDB-3605} customfield_11808 Function
> $issue|Save-JIssue
Save-JIssue : System.InvalidOperationException with Save issue [ITDR-150]: [data was not an array]
At line:1 char:6
+ $issue|Save-JIssue
+ ~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Save-JIssue], JiraInvalidActionException
+ FullyQualifiedErrorId : Save issue [ITDR-150],JiraModule.SaveIssue I have a working method now with JiraPS, so this is for your information. As the say at JiraPS:
|
Thank you for testing that out. I'll have to dig into the SDK source then to see if it is even supported. or even what is really supported. |
How do I enter an array to the input data for customfields? I tried different versions, but I had no success so far.
This is for an Insight object.
When I get the issue, it looks like this:
The text was updated successfully, but these errors were encountered: