Add-TaskComment
  • 1 Minute to read
  • Dark
    Light
  • PDF

Add-TaskComment

  • Dark
    Light
  • PDF

Article summary

Summary

Creates a new task comment.

Add-TaskComment
    -Entry
    -IncludeTask

Returns a task comment object.

Parameters

ParameterTypeRequired?Notes
EntryTask Comment ObjectYes
IncludeTaskSwitchNo, Defaults to falseIncludes the parent task property.

Examples

Create a new task comment

# Create a new task comment (general comment)

# Provide the necessary fields to create the task comment

# For `CommentTypeId`, provide one of the following:
#   1: General
#   2: Issue
#   3: Question
#   4: Cancel Task

$entry = @{
    TaskID          = 966
    CommentTypeId   = 1
    Value           = "QC completed without any issues."
}

# Create the comment. The created entry will be returned back.
$data = Add-TaskComment -Entry $entry

# Output some information to help indicate that the comment was created
Write-Output "Task comment $($data.TaskCommentId) was created on task $($data.TaskId)"

# For debug purposes, convert the data to output as JSON so we can see all the fields
Write-Output ""
Write-Output "JSON Results:"

$jsonOutput = $data | ConvertTo-Json -Depth 10

# Output the data
Write-Output $jsonOutput

Results of executing the script:

Task comment 935 was created on task 966

JSON Results:
{
  "Metadata": null,
  "Task": null,
  "CreatedBy": null,
  "ChildComments": [],
  "TaskCommentId": 935,
  "TaskId": 966,
  "TaskName": "Processing QC",
  "RelatedTaskCommentId": null,
  "Value": "QC completed without any issues.",
  "CommentTypeId": 1,
  "CommentTypeName": "General",
  "IsBlocking": false,
  "IsQCRelated": false,
  "IsExternal": false,
  "CreatedByFullName": "Max Miller",
  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "CreatedOn": "2024-03-04T20:06:40.3018202+00:00",
  "LastUpdatedByFullName": "Max Miller",
  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "LastUpdatedOn": "2024-03-04T20:06:40.3018202+00:00",
  "LastUpdatedBy": null
}