Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

1 answer

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
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

263 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you