--- title: "Set-Task" slug: "scripting-set-task" updated: 2025-07-16T12:42:08Z published: 2025-07-16T12:42:08Z canonical: "help.agilityblue.com/scripting-set-task" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.agilityblue.com/llms.txt > Use this file to discover all available pages before exploring further. # Set-Task ## Summary Updates an existing task. ```powershell Set-Task    -Entry    -IncludeForms    -IncludeProject ``` Returns a [task](https://apidocs.agilityblue.com/#7188f9cc-69d1-4f96-818f-bb8b2d08e739) object. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | Entry | [Task](https://apidocs.agilityblue.com/#7188f9cc-69d1-4f96-818f-bb8b2d08e739) Object | Yes | The task object used to update an existing entry. | | IncludeForms | Switch | No, Defaults to `false` | Adds the child `Forms` collection property to the output. | | IncludeProject | Switch | No, Defaults to `false` | Adds the parent `Project` property to the output. | ## Examples ### Update an existing task ```powershell # Retrieve an existing task and include the task forms $taskToUpdate = Get-Task -Id 1123 -IncludeForms # Update the due date field so the task is due in 24 hours from now $taskToUpdate.DateDue = (Get-Date).AddHours(24) # Retrieve a field within a form by the field's label $instructionsField = $taskToUpdate.Forms |    ForEach-Object { $_.Sections } |    ForEach-Object { $_.Fields } |    Where-Object { $_.Label -eq "Instructions" } # Append a couple of line breaks and a message about the new due date to the field. $instructionsField.ValueAsString += "

Edited to be due within 24 hours." # Update the task. The modified entry will be returned back, but won't contain the forms. $updatedTask = Set-Task -Entry $taskToUpdate # Retrieve the task with forms so we can write an output message that includes them $updatedTask = Get-Task -Id $updatedTask.TaskId -IncludeForms # Output some information to help indicate that the task was created Write-Output "Task $($updatedTask.TaskId) ($($updatedTask.Name)) was updated" # For debug purposes, convert the data to output as JSON so we can see all the fields Write-Output "" Write-Output "JSON Results:" $jsonOutput = $updatedTask | ConvertTo-Json -Depth 10 # Output the data Write-Output $jsonOutput ``` Execution results: ```json Task 1123 (Monthly KPI Review) was updated 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.

Edited to be due within 24 hours.",              "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": "2025-07-17T12:36:12.9484378+00:00",  "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-16T12:36:12.9694981+00:00",  "LastUpdatedBy": null } ```