< Back

New-JiraIssue

Thu Jan 16, 2020 8:08 am

NAME New-JiraIssue



SYNOPSIS

Creates a new issue in JIRA





SYNTAX

New-JiraIssue [-Project] <String> [[-Fields] <PSCustomObject>] [[-Credential] <PSCredential>] [-IssueType]

<String> [-Summary] <String> [[-Priority] <Int32>] [[-Description] <String>] [[-Reporter] <String>] [[-Labels]

<String[]>] [[-Parent] <String>] [[-FixVersion] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

This function creates a new issue in JIRA.



Creating an issue requires a lot of data, and the exact data may be different from one instance of JIRA to the

next.



To identify what data is required for a given issue type and project, use the `Get-JiraIssueCreateMetadata`

function provided in this module.



Some JIRA instances may require additional custom fields specific to that instance of JIRA. In addition to the

parameterized fields provided in this function, the Fields parameter accepts a hashtable of field names/IDs and

values. This allows users to provide custom field data when creating an issue. Read more about it in

about_JiraPS_CustomFields (../../about/custom-fields.html)





PARAMETERS

-Project <String>

Project in which to create the issue.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IssueType <String>

Type of the issue.



Required? true

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Summary <String>

Summary of the issue.



Required? true

Position? 3

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Priority <Int32>

ID of the Priority the issue shall have.



Required? false

Position? 4

Default value 0

Accept pipeline input? False

Accept wildcard characters? false



-Description <String>

Long description of the issue.



Required? false

Position? 5

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Reporter <String>

User that shall be registered as the reporter.



If left empty, the currently authenticated user will be used.



Required? false

Position? 6

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Labels <String[]>

List of labels which will be added to the issue.



Required? false

Position? 7

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Parent <String>

Parent issue - in case of issues of type "Sub-Tasks".



Required? false

Position? 8

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-FixVersion <String[]>

Set the FixVersion of the issue.



Required? false

Position? 9

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Fields <PSCustomObject>

Any additional fields.



See: about_JiraPS_CustomFields



Required? false

Position? 10

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Credential <PSCredential>

Credentials to use to connect to JIRA.

If not specified, this function will use anonymous access.



Required? false

Position? 11

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

[JiraPS.Issue]







NOTES





This function requires either the `-Credential` parameter to be passed or a persistent JIRA session. See

`New-JiraSession` for more details. If neither are supplied, this function will run with anonymous access to

JIRA.



-------------------------- EXAMPLE 1 --------------------------



New-JiraIssue -Project "TEST" -Type "Bug" -Summary "Test issue"



Creates a new issue in the TEST project.



This is the simplest way possible to use the command, given the project only requires these fields as mandatory.

-------------------------- EXAMPLE 2 --------------------------



Get-JiraIssueCreateMetadata -Project TEST -IssueType Bug | ? {$_.Required -eq $true}

New-JiraIssue -Project TEST -IssueType Bug -Priority 1 -Summary 'Test issue from PowerShell' -Description 'This is

a test issue created from the JiraPS module in PowerShell.' -Fields @{'Custom Field Name 1'=@{"foo" =

"bar"};'customfield_10001'=@('baz');}



This example uses `Get-JiraIssueCreateMetadata` to identify fields required to create an issue in JIRA. It then

creates an issue with the Fields parameter providing a field name and a field ID.

-------------------------- EXAMPLE 3 --------------------------



$parameters = @{

Project = "TEST"

IssueType = "Bug"

Priority = 1

Summary = 'Test issue from PowerShell'

Description = 'This is a test issue created from the JiraPS module in PowerShell.'

Fields = @{

"Custom Field Name 1" = @{"foo" = "bar"}

customfield_10001 = @('baz')

}

}

New-JiraIssue @parameters



This illustrates how to use splatting for the example above.



Read more about splatting: about_Splatting

-------------------------- EXAMPLE 4 --------------------------



"project,summary,assignee,IssueType,Priority,Description" > "./data.csv"

"CS,Some Title 1,admin,Minor,1,Some Description 1" >> "./data.csv"

"CS,Some Title 2,admin,Minor,1,Some Description 2" >> "./data.csv"

import-csv "./data.csv" | New-JiraIssue



This example illuetrates how to prepare multiple new stories and pipe them to be created all at once.



RELATED LINKS

Online Version: https://atlassianps.org/docs/JiraPS/com ... JiraIssue/

about_JiraPS_CreatingIssues

about_JiraPS_CustomFields

Get-JiraIssueCreateMetadata

Get-JiraComponent

Get-JiraField

Get-JiraPriority

Get-JiraProject

Get-JiraVersion