< Back

Add-JiraIssueWorklog

Thu Jan 16, 2020 7:45 am

NAME Add-JiraIssueWorklog



SYNOPSIS

Adds a worklog item to an existing JIRA issue





SYNTAX

Add-JiraIssueWorklog [-Comment] <String> [-Issue] <Object> [-TimeSpent] <TimeSpan> [-DateStarted] <DateTime>

[[-VisibleRole] <String>] [[-Credential] <PSCredential>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

This function adds a worklog item to an existing issue in JIRA. You can optionally set the visibility of the item

(All Users, Developers, or Administrators).





PARAMETERS

-Comment <String>

Worklog item that should be added to JIRA



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Issue <Object>

Issue to receive the new worklog item.



Can be a `JiraPS.Issue` object, issue key, or internal issue ID.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-TimeSpent <TimeSpan>

Time spent to be logged



Required? true

Position? 3

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-DateStarted <DateTime>

Date/time started to be logged



Required? true

Position? 4

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-VisibleRole <String>

Visibility of the comment.

Defines if the comment should be publicly visible, viewable to only developers, or only administrators.



Allowed values are:



- `All Users`



- `Developers`



- `Administrators`



Required? false

Position? 5

Default value All Users

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? 6

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

This function can accept JiraPS.Issue objects via pipeline.







OUTPUTS

[JiraPS.Worklogitem]







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 --------------------------



Add-JiraIssueWorklog -Comment "Test comment" -Issue "TEST-001" -TimeSpent 60 -DateStarted (Get-Date)



This example adds a simple worklog item to the issue TEST-001.

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



Get-JiraIssue "TEST-002" | Add-JiraIssueWorklog "Test worklog item from PowerShell" -TimeSpent 60 -DateStarted

(Get-Date)



This example illustrates pipeline use from `Get-JiraIssue` to `Add-JiraIssueWorklog`.

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



Get-JiraIssue -Query 'project = "TEST" AND created >= -5d' |

Add-JiraIssueWorklog "This issue has been cancelled per Vice President's orders." -TimeSpent 60 -DateStarted

(Get-Date)



This example illustrates logging work on all projects which match a given JQL query. It would be best to validate

the query first to make sure the query returns the expected issues!

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



$comment = Get-Process | Format-Jira

Add-JiraIssueWorklog $comment -Issue TEST-003 -TimeSpent 60 -DateStarted (Get-Date)



This example illustrates adding a comment based on other logic to a JIRA issue.



Note the use of `Format-Jira` to convert the output of `Get-Process` into a format that is easily read by users.



RELATED LINKS

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

Get-JiraIssue

Format-Jira