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,456,654
Community Members
 
Community Events
176
Community Groups

JiraPS - Set-JiraIssue, unexpected results

Context:

Using JiraPS module, latest, and PowerShell 5.1. On Windows platform.

I am implementing automated creation and updating of Jira Versions as well as Jira Issues. This is regarding updating a previously created Jira Issue using Set-JiraIssue.

Objective:

Update the DueDate field in an existing Jira Issue using Set-JiraIssue. Below is what I'm calling:

$parameters = @{
  Fields = @{
  DueDate = $NewDueDate
  }
}

Set-JiraIssue $parameters -Issue $JiraKey

 

*$NewDueDate is formatted as a string with -Format "MMMM d, yyyy"

Negative Outcome:

Even though I am only attempting to set the DueDate I am getting the Jira's Summary field value changed (as reflected through the Jira web UI) to the text "System.Collections.Hashtable". And the DueDate field is not updated.

Request:

Please advise where I am going wrong.

I am using calls to Set-JiraIssue elsewhere (but without the parameters & Fields API syntax). I am successfully using the parameters & Fields API syntax in conjunction with calls to New-JiraIssue. I am currently stumped as to where I am going astray here and searching for clues that might resolve my problem.

TIA

2 answers

Really late to the party, but figured I'd update since you both helped me figure it out. Looks  like instead of $parameters, use @parameters. This worked for me:

$j = Get-JiraIssue -Key "RTSAFSYSEN-2521"
$J.DueDate
2022-10-01
$parameters = @{Fields = @{DueDate = "2022-10-10"}}
Set-JiraIssue -key $j.key @parameters -WhatIf
What if: Performing the operation "Updating Issue" on target "RTSAFSYSEN-2521".
Set-JiraIssue -key $j.key @parameters
$j = Get-JiraIssue -Key "RTSAFSYSEN-2521"
$J.DueDate
2022-10-10

What format is the time/date in if you do a get-jiraissue?

Sorry for the delayed response, just getting back to this issue.

The format returned for the jira issue DueDate is "yyyy-MM-dd", as in 2021-11-16.

Using the same date format doesn't seem to resolve my inability to update in this case.

See example below. Any insight(s) to resolve are appreciated.

Thanks

Example:

$j = Get-JiraIssue -Key "RM-4001"

$J.DueDate 

     2021-11-16

$parameters = @{Fields = @{DueDate = "2021-11-16"}}
$j | Set-JiraIssue -Fields $parameters -WhatIf
What if: Performing the operation "Updating Issue" on target "RM-4001".
$j | Set-JiraIssue -Fields $parameters
      Invoke-JiraMethod : An unknown error ocurred.
       At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.14.3\JiraPS.psm1:5509 char:21
       + Invoke-JiraMethod @parameter
       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
       + FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events