Add-Task

Prev Next

Summary

Creates a new task.

Add-Task
    -Entry

Returns a task object.

Additional Details

Check out the Concepts: Tasks & Task Forms article for more detailed information about tasks.

Parameters

Parameter

Type

Required?

Notes

Entry

Task Object

Yes

The task used to create a new entry.

Examples

Create a new task

# Create a new "General Instructions" task using only required fields

$entry = @{
    Name = "Monthly KPI Review"
    ProjectId = 2025040000001
    Forms = @(
        @{
            FormId = 1
            Name = "General Instructions"
            Sections = @(
                @{
                    FormSectionId = 1
                    Fields = @(
                        @{
                            FieldId = 1
                            Label = "Instructions"
                            ValueAsString = "Please run the monthly KPI reports and return them to management."
                        }
                    )
                }
            )
        }
    )
}

# Create the task. The created entry will be returned back, but won't contain the forms.
$data = Add-Task -Entry $entry

# Retrieve the task with forms so we can write an output message that includes them
$data = Get-Task -Id $data.TaskId -IncludeForms

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

# 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

Execution results:

Task 1123 (Monthly KPI Review) was created

JSON Results:
{
  "Metadata": null,
  "AssignedBy": null,
  "AssignedTo": null,
  "Client": null,
  "CompletedBy": null,
  "CreatedBy": null,
  "Forms": [
    {
      "TaskFormId": 1219,
      "TaskId": 1123,
      "FormId": 1,
      "Guid": 1752610927023,
      "Name": "General Instructions",
      "Sections": [
        {
          "TaskFormSectionId": 1434,
          "FormSectionId": null,
          "TaskFormId": 1219,
          "Heading": null,
          "Position": 0,
          "Guid": 1,
          "Fields": [
            {
              "TaskFormFieldId": 5387,
              "FieldId": 1,
              "TaskFormSectionId": 1434,
              "DataTypeId": 2,
              "DataTypeName": "Rich Text",
              "Label": "Instructions",
              "ValueAsString": "Please run the monthly KPI reports and return them to management.",
              "ValueAsBoolean": null,
              "ValueAsNumber": null,
              "ValueAsDecimal": null,
              "ValueAsDate": null,
              "DefaultValue": null,
              "IsRequired": false,
              "IsVisible": true,
              "Position": 0,
              "Guid": 1,
              "ReferenceObject": null,
              "AppliedProperties": []
            }
          ]
        }
      ]
    }
  ],
  "Matter": null,
  "Project": null,
  "QualityCheckPerformedBy": null,
  "Subscribers": [],
  "TaskId": 1123,
  "ProjectId": 2025040000001,
  "ProjectTypeId": 1,
  "ProjectTypeName": "Normal",
  "ProjectTypeDescription": "The normal project type where task work is performed.",
  "ProjectSourceTypeId": 2,
  "ProjectSourceTypeName": "Agility Blue",
  "ProjectDescription": "Automated Reports",
  "ProjectComputedTags": null,
  "ProjectRequesterId": null,
  "ProjectRequesterFirstName": null,
  "ProjectRequesterLastName": null,
  "ProjectRequesterFullName": null,
  "ProjectRequesterEmail": null,
  "MatterId": 107,
  "MatterName": "Automated Reports",
  "MatterReference": null,
  "ClientId": 94,
  "ClientName": "Automation",
  "ClientReference": null,
  "Name": "Monthly KPI Review",
  "AssignedToId": null,
  "AssignedToFullName": null,
  "AssignedById": null,
  "AssignedByFullName": null,
  "EstimatedHours": null,
  "ActualHours": null,
  "StatusId": 1,
  "StatusDescription": "New",
  "QualityCheckStatusId": 1,
  "QualityCheckStatusDescription": "Not Performed",
  "QualityCheckPerformedById": null,
  "QualityCheckPerformedByFullName": null,
  "FormNames": "General Instructions",
  "SortOrder": 0,
  "DateDue": null,
  "CompletedOn": null,
  "CompletedById": null,
  "CompletedByFullName": null,
  "AssignedOn": null,
  "NumberOfComments": 0,
  "NumberOfAttachments": 0,
  "NumberOfMediaLogEntries": 0,
  "NumberOfVolumes": 0,
  "NumberOfBillingEntries": 0,
  "NumberOfSubscribers": 0,
  "NumberOfEmailMessages": 0,
  "CreatedByFullName": "Max Miller",
  "CreatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
  "CreatedOn": "2025-07-15T20:22:07.0068888+00:00",
  "LastUpdatedByFullName": "Max Miller",
  "LastUpdatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
  "LastUpdatedOn": "2025-07-15T20:22:07.0068888+00:00",
  "LastUpdatedBy": null
}