en-US/about_JiraPS_CreatingIssues.help.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
TOPIC
    about_jiraps_creatingissues
 
SHORT DESCRIPTION
    Each project and issue type has different requirements. This article shows
    how to know what is mandatory when creating a new issue.
 
LONG DESCRIPTION
    In order to create a new issue in Jira, you need to provide a certain amount
    of information about the issue. In the Web interface, you encounter this all
    the time when you hit the "Create Issue" button.
    To create an issue using JiraPS, you need to provide this information as
    well. Before you can provide the needed information to create an issue,
    though, you'll need to know what information your Jira instance requires!
    This can be dramatically different from one Jira instance to the next, and
    even from one project to another.
 
Identifying "Create" Metadata
    JiraPS includes a command to make discovering this metadata as simple as
    possible. You will need to provide both a project and an issue type to this
    function, because each project and issue type can be configured to accept or
    require different fields when creating issues.
 
    Get-JiraIssueCreateMetadata -Project TEST -IssueType Task
 
    There are quite a lot of fields that we can provide when we create a new issue!
    This function returns any fields that we can provide when creating a new
    issue. Not all of these fields are required, though. We can use PowerShell's
    `Where-Object` cmdlet to filter for only the required fields:
 
    Get-JiraIssueCreateMetadata -Project TEST -IssueType Task | ? {$_.Required -eq $true}
 
Creating An Issue
    Now that we know what fields we need to provide our Jira instance, let's
    create an issue!
 
    New-JiraIssue -Project TEST -IssueType Task -Reporter 'powershell' -Summary 'Test issue from PowerShell' -Credential $myJiraCreds
 
    This might be all the information we would need to pass `New-JiraIssue` to
    create a new Jira issue. We can do much more, though:
 
    $parameters = @{
        Project = TEST
        IssueType = Task
        Reporter = 'powershell'
        Summary = 'Test issue from PowerShell'
        Description = "This is a sample issue created by $env:USERNAME on $env:COMPUTERNAME."
        Labels = 'Test','Fake'
        Credential = $myJiraCreds
    }
    New-JiraIssue @parameters
 
Additional Fields
    In most Jira instances, the default fields are not the only fields necessary
    when creating an issue. Most organizations have additional information they
    track in Jira through the use of custom issue fields.
    `New-JiraIssue` provides the `-Fields` parameter for working with these
    custom fields:
 
    New-JiraIssue -Fields @{
        'customfield_10001'='foo'
        # Other New-JiraIssue parameters
    }
 
    For more information on the `-Fields` parameter, see the
    custom fields
    page.
 
NOTE
    You don't need to pass your credentials to Jira every time you run
    `New-JiraIssue`. See the
    authentication
    page for details.