AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
322 stars 131 forks source link

How To set time tracking with New-JiraIssue correctly? #386

Closed sonadorixx closed 4 years ago

sonadorixx commented 4 years ago

I've read the documentation so far, but im not able to set the time tracking when creating a new issue.

at the moment i try this.

$parameters  = @{
                project = $item.Node.projectKey
                summary = $item.Node.summary
                description = $item.Node.description
                issueType = $item.Node.issueType
                Priority = if ($item.Node.priority -eq "Showstopper") {'10000'} else {'10201'}
                Reporter = $User
                Fields = @{
                    components = @(
                        @{ name = $item.Node.components.component }
                    )
                    customfield_10606 = $startTime
                    timetracking = @(
                        @{originalEstimate = $item.Node.estimatedDuration }
                        @{remainingEstimate = $item.Node.estimatedDuration }
                    )
                    customfield_10607 = $endTime
                    fixVersions = @(
                        @{ name = $release }
                    )
}
$IssueCreation = New-JiraIssue @parameters

But this is causing an error:

Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.TimeTrackingJsonBean...

Any hint how to solve this?

lipkau commented 4 years ago

This is the correct format:

Fields = @{
        timetracking = @{
            originalEstimate = "10d"
            remainingEstimate = "1d"
        }
    }
sonadorixx commented 4 years ago

Works :) Thank you!