--- title: "Add-Client" slug: "scripting-add-client" tags: ["Enterprise Only"] updated: 2025-07-16T16:35:49Z published: 2025-07-16T16:35:49Z canonical: "help.agilityblue.com/scripting-add-client" --- > ## 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-Client ## Summary Creates a new client. ```powershell Add-Client    -Entry    -BypassCustomFieldValidation ``` Returns a [client](https://apidocs.agilityblue.com/#8a0ddaea-a579-44a7-941f-f6bb38520603) object. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | Entry | [Client](https://apidocs.agilityblue.com/#8a0ddaea-a579-44a7-941f-f6bb38520603) object | Yes | The client object to create as a new entry. | | BypassCustomFieldValdiation | Switch | No, Defaults to `false` | Ignores required field requirement for custom fields when the entry is saved. | ## Examples ### Create a new client (no custom fields) ```powershell # Create a new client (no custom fields) # Create an object with the necessary fields to create the client # Note: The Reference field is not required, but we're including it here due to how # common it is to contain information. $entry = @{    Name        = "QuantumTech v. CyberInnovate"    Reference   = "QT00001" } # Create the client. The created entry will be returned back. $data = Add-Client -Entry $entry # Output some information to help indicate that the client was created Write-Output "Client $($data.ClientId) ($($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 ``` Results of executing the script: ```json Client 67 (QuantumTech v. CyberInnovate) was created JSON Results: {  "ClientId": 67,  "Name": "QuantumTech v. CyberInnovate",  "Reference": "QT00001",  "Active": true,  "IsFavorite": false,  "NumberOfMatters": 0,  "NumberOfProjects": 0,  "NumberOfTasks": 0,  "NumberOfMediaLogEntries": 0,  "NumberOfVolumes": 0,  "NumberOfBillingEntries": 0,  "NumberOfComments": 0,  "FirstProjectCreatedOnDate": null,  "LastProjectCreatedOnDate": null,  "CreatedByFullName": "Max Miller",  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "CreatedOn": "2024-03-05T15:11:14.9089738+00:00",  "CreatedBy": null,  "LastUpdatedByFullName": "Max Miller",  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "LastUpdatedOn": "2024-03-05T15:11:14.9089738+00:00",  "LastUpdatedBy": null,  "Fields": [    {      "FieldId": 10,      "ObjectId": 1,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Main Contact Name",      "IsRequired": false,      "Position": 0,      "Guid": 1475776072753,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    },    {      "FieldId": 14,      "ObjectId": 1,      "DataTypeId": 2,      "DataTypeName": "Rich Text",      "Label": "Client Address",      "IsRequired": false,      "Position": 3,      "Guid": 1476994440044,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    },    {      "FieldId": 20,      "ObjectId": 1,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Primary Phone",      "IsRequired": false,      "Position": 1,      "Guid": 1500308933569,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    },    {      "FieldId": 21,      "ObjectId": 1,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Primary Email",      "IsRequired": false,      "Position": 2,      "Guid": 1500308948435,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    },    {      "FieldId": 27,      "ObjectId": 1,      "DataTypeId": 2,      "DataTypeName": "Rich Text",      "Label": "Notes and Misc.",      "IsRequired": false,      "Position": 4,      "Guid": 1531172010609,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    },    {      "FieldId": 55,      "ObjectId": 1,      "DataTypeId": 10,      "DataTypeName": "Reference",      "Label": "User",      "IsRequired": false,      "Position": 5,      "Guid": 2907893454017,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    }  ] } ``` ### Create a new client (with custom fields) ```powershell # Create a new client (with custom fields) # Create an object with the necessary fields to create the client # Note: The Reference field is not required, but we're including it here due to how # common it is to contain information. # Note: This example includes a custom reference field that points to a user $entry = @{  Name      = "SoundWave Studios IV"  Reference = "SWS0001"  Fields    = @(    @{      FieldId = 10      Label   = "Main Contact Name"      Value   = @{        ValueAsString = "Seth Trapsitell"      }    }    @{      FieldId = 14      Label   = "Client Address"      Value   = @{        ValueAsString = "

123 Drive
Nowhere, USA
55555

"      }    }    @{      FieldId = 20      Label   = "Primary Phone"      Value   = @{        ValueAsString = "555-1234"      }    }    @{      FieldId = 21      Label   = "Primary Email"      Value   = @{        ValueAsString = "strapsitell@agilityblue.com"      }    }    @{      FieldId = 55      Label   = "User"      Value   = @{        ReferenceObject = @{          Values = @(            @{              KeyAsString = "2c35e3b4-2e17-4ee6-b192-e92e4db5cf3c"              Value       = "Roger Schlachter"            }          )        }      }    }  ) } # Create the client. The created entry will be returned back. $data = Add-Client -Entry $entry # Output some information to help indicate that the client was created Write-Output "Client $($data.ClientId) ($($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 ``` Results of executing the script: ```plaintext Client 71 (SoundWave Studios IV) was created JSON Results: {  "ClientId": 71,  "Name": "SoundWave Studios IV",  "Reference": "SWS0001",  "Active": true,  "IsFavorite": false,  "NumberOfMatters": 0,  "NumberOfProjects": 0,  "NumberOfTasks": 0,  "NumberOfMediaLogEntries": 0,  "NumberOfVolumes": 0,  "NumberOfBillingEntries": 0,  "NumberOfComments": 0,  "FirstProjectCreatedOnDate": null,  "LastProjectCreatedOnDate": null,  "CreatedByFullName": "Max Miller",  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "CreatedOn": "2024-03-05T19:06:18.62521+00:00",  "CreatedBy": null,  "LastUpdatedByFullName": "Max Miller",  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "LastUpdatedOn": "2024-03-05T19:06:18.62521+00:00",  "LastUpdatedBy": null,  "Fields": [    {      "FieldId": 10,      "ObjectId": 1,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Main Contact Name",      "IsRequired": false,      "Position": 0,      "Guid": 1475776072753,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2135,        "ObjectFieldId": 10,        "ObjectId": 1,        "PrimaryKeyId": 71,        "ValueAsString": "Seth Trapsitell",        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": null      },      "ReferenceObject": null    },    {      "FieldId": 14,      "ObjectId": 1,      "DataTypeId": 2,      "DataTypeName": "Rich Text",      "Label": "Client Address",      "IsRequired": false,      "Position": 3,      "Guid": 1476994440044,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2136,        "ObjectFieldId": 14,        "ObjectId": 1,        "PrimaryKeyId": 71,        "ValueAsString": "

123 Drive
Nowhere, USA
55555

",        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": null      },      "ReferenceObject": null    },    {      "FieldId": 20,      "ObjectId": 1,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Primary Phone",      "IsRequired": false,      "Position": 1,      "Guid": 1500308933569,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2137,        "ObjectFieldId": 20,        "ObjectId": 1,        "PrimaryKeyId": 71,        "ValueAsString": "555-1234",        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": null      },      "ReferenceObject": null    },    {      "FieldId": 21,      "ObjectId": 1,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Primary Email",      "IsRequired": false,      "Position": 2,      "Guid": 1500308948435,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2138,        "ObjectFieldId": 21,        "ObjectId": 1,        "PrimaryKeyId": 71,        "ValueAsString": "strapsitell@agilityblue.com",        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": null      },      "ReferenceObject": null    },    {      "FieldId": 27,      "ObjectId": 1,      "DataTypeId": 2,      "DataTypeName": "Rich Text",      "Label": "Notes and Misc.",      "IsRequired": false,      "Position": 4,      "Guid": 1531172010609,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2139,        "ObjectFieldId": 27,        "ObjectId": 1,        "PrimaryKeyId": 71,        "ValueAsString": null,        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": null      },      "ReferenceObject": null    },    {      "FieldId": 55,      "ObjectId": 1,      "DataTypeId": 10,      "DataTypeName": "Reference",      "Label": "User",      "IsRequired": false,      "Position": 5,      "Guid": 2907893454017,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2140,        "ObjectFieldId": 55,        "ObjectId": 1,        "PrimaryKeyId": 71,        "ValueAsString": null,        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": {          "ObjectFieldReferenceObjectInstanceId": 320,          "ObjectFieldValueId": 2140,          "ObjectId": 8,          "Object": null,          "PrimaryObjectId": 1,          "PrimaryKeyId": 71,          "KeyType": "String",          "DisplayFormat": "%Val%",          "IsSystemObject": true,          "Name": null,          "NumberOfValues": 1,          "Values": [            {              "ObjectFieldReferenceObjectInstanceValueId": 239,              "ObjectFieldReferenceObjectInstanceId": 320,              "KeyAsString": "2c35e3b4-2e17-4ee6-b192-e92e4db5cf3c",              "KeyAsInteger": null,              "KeyAsLong": null,              "Value": "Roger Schlachter"            }          ]        }      },      "ReferenceObject": null    }  ] } ```