--- title: "Add-FormsToTask" slug: "scripting-add-formstotask" updated: 2025-07-16T12:43:47Z published: 2025-07-16T12:43:47Z canonical: "help.agilityblue.com/scripting-add-formstotask" --- > ## 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. # Add-FormsToTask ## Summary Add forms to an existing task. ```powershell Add-FormsToTask    -TaskId    -Forms ``` Returns a [task](https://apidocs.agilityblue.com/#7188f9cc-69d1-4f96-818f-bb8b2d08e739) object. > [!NOTE] > Additional Details > > Check out the [Concepts: Tasks & Task Forms](/v1/docs/scripting-tutorials-tasks-and-task-forms) article for more detailed information about tasks. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | TaskId | Int32 | Yes | The task id. | | Forms | List | Yes | The list of task form objects to add to the task. | ## Examples ### Add a form to an existing task ```powershell # Add a new "General Instructions" form to an existing task $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."                    }                )            }        )    } ) # Add forms to the task. The task object will be returned back, but without forms $data = Add-FormsToTask -TaskId 1123 -Forms $forms # Retrieve the task with forms to display the output $data = Get-Task -Id $data.TaskId -IncludeForms # Output some information to help indicate that the task was created Write-Output "Added a form to task $($data.TaskId) ($($data.Name))" # 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: ```json Added a form to task 1123 (Monthly KPI Review) JSON Results: {  "Metadata": null,  "AssignedBy": null,  "AssignedTo": null,  "Client": null,  "CompletedBy": null,  "CreatedBy": null,  "Forms": [    {      "TaskFormId": 1219,      // Previous form details omitted for clarity    },    {      "TaskFormId": 1220,      "TaskId": 1123,      "FormId": 1,      "Guid": 1752612342251,      "Name": "General Instructions",      "Sections": [        {          "TaskFormSectionId": 1435,          "FormSectionId": null,          "TaskFormId": 1220,          "Heading": null,          "Position": 0,          "Guid": 1,          "Fields": [            {              "TaskFormFieldId": 5388,              "FieldId": 1,              "TaskFormSectionId": 1435,              "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 } ```