--- title: "Add-Contact" slug: "scripting-add-contact" tags: ["Enterprise Only"] updated: 2025-07-16T16:38:24Z published: 2025-07-16T16:38:24Z canonical: "help.agilityblue.com/scripting-add-contact" --- > ## 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-Contact ## Summary Creates a new contact. ```powershell Add-Contact    -Entry    -BypassCustomFieldValidation ``` Returns a [contact](https://apidocs.agilityblue.com/#42542659-8ff2-4dee-aaab-2a003f98641c) object. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | Entry | [Contact](https://apidocs.agilityblue.com/#42542659-8ff2-4dee-aaab-2a003f98641c) Object | Yes | The contact 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 contact (no custom fields) ```powershell # Create a new contact (no custom fields) # Create an object with the necessary fields to create the contact # Note: The email field is the only required system field for the contact object $entry = @{    EmailAddress        = "econnor@company.com"    FirstName           = "Ellena"    LastName            = "Connor"    TimeZoneIdentifier  = "Central Standard Time" } # Create the contact. The created entry will be returned back. $data = Add-Contact -Entry $entry # Output some information to help indicate that the contact was created Write-Output "Contact $($data.ContactId) ($($data.NameAndEmailAddress)) 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: ```json Contact 78 (Ellena Connor ) was created JSON Results: {  "ContactId": 78,  "FirstName": "Ellena",  "LastName": "Connor",  "FullName": "Ellena Connor",  "EmailAddress": "econnor@company.com",  "NameAndEmailAddress": "Ellena Connor ",  "PhoneNumber": null,  "TimeZoneIdentifier": "Central Standard Time",  "EnableNotifications": false,  "AllowPortalAccess": false,  "IsFavorite": false,  "NumberOfProjects": 0,  "CreatedByFullName": "Max Miller",  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "CreatedOn": "2024-04-17T14:24:18.4674264+00:00",  "CreatedBy": null,  "LastUpdatedByFullName": "Max Miller",  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "LastUpdatedOn": "2024-04-17T14:24:18.4674264+00:00",  "LastUpdatedBy": null,  "Fields": [    {      "FieldId": 50,      "ObjectId": 7,      "DataTypeId": 10,      "DataTypeName": "Reference",      "Label": "Skills",      "IsRequired": false,      "Position": 0,      "Guid": 7413322756636,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    },    {      "FieldId": 67,      "ObjectId": 7,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Office Location",      "IsRequired": false,      "Position": 1,      "Guid": 1756477664260,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": null,      "ReferenceObject": null    }  ] } ``` ### Create a new contact (with custom fields) ```powershell # Create a new contact (no custom fields) # Create an object with the necessary fields to create the contact # Note: The email field is the only required system field for the contact object $entry = @{    EmailAddress    = "dherman@company.com"    FirstName       = "Danielle"    LastName        = "Herman"    Fields          = @(        @{            FieldId = 50            Label   = "Skills"            Value   = @{                ReferenceObject = @{                    Values  = @(                        @{                            KeyAsInteger    = 2                            Value           = "Analytics"                        }                    )                }            }        }        @{            FieldId = 67            Label   = "Office Location"            Value   = @{                ValueAsString = "Minneapolis"            }        }    ) } # Create the contact. The created entry will be returned back. $data = Add-Contact -Entry $entry # Output some information to help indicate that the contact was created Write-Output "Contact $($data.ContactId) ($($data.NameAndEmailAddress)) 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: ```plaintext Contact 79 (Danielle Herman ) was created JSON Results: {  "ContactId": 79,  "FirstName": "Danielle",  "LastName": "Herman",  "FullName": "Danielle Herman",  "EmailAddress": "dherman@company.com",  "NameAndEmailAddress": "Danielle Herman ",  "PhoneNumber": null,  "TimeZoneIdentifier": null,  "EnableNotifications": false,  "AllowPortalAccess": false,  "IsFavorite": false,  "NumberOfProjects": 0,  "CreatedByFullName": "Max Miller",  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "CreatedOn": "2024-04-17T15:06:19.2753792+00:00",  "CreatedBy": null,  "LastUpdatedByFullName": "Max Miller",  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",  "LastUpdatedOn": "2024-04-17T15:06:19.2753792+00:00",  "LastUpdatedBy": null,  "Fields": [    {      "FieldId": 50,      "ObjectId": 7,      "DataTypeId": 10,      "DataTypeName": "Reference",      "Label": "Skills",      "IsRequired": false,      "Position": 0,      "Guid": 7413322756636,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2178,        "ObjectFieldId": 50,        "ObjectId": 7,        "PrimaryKeyId": 79,        "ValueAsString": null,        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": {          "ObjectFieldReferenceObjectInstanceId": 326,          "ObjectFieldValueId": 2178,          "ObjectId": 16,          "Object": null,          "PrimaryObjectId": 7,          "PrimaryKeyId": 79,          "KeyType": "Int32",          "DisplayFormat": "%Name%",          "IsSystemObject": false,          "Name": null,          "NumberOfValues": 1,          "Values": [            {              "ObjectFieldReferenceObjectInstanceValueId": 243,              "ObjectFieldReferenceObjectInstanceId": 326,              "KeyAsString": null,              "KeyAsInteger": 2,              "KeyAsLong": null,              "Value": "Analytics"            }          ]        }      },      "ReferenceObject": null    },    {      "FieldId": 67,      "ObjectId": 7,      "DataTypeId": 1,      "DataTypeName": "Basic Text",      "Label": "Office Location",      "IsRequired": false,      "Position": 1,      "Guid": 1756477664260,      "IsSystemField": false,      "IsReferenceValue": false,      "DefaultValue": null,      "CopyPreviousValueOnSaveAndNew": false,      "Value": {        "ObjectFieldValueId": 2179,        "ObjectFieldId": 67,        "ObjectId": 7,        "PrimaryKeyId": 79,        "ValueAsString": "Minneapolis",        "ValueAsBoolean": null,        "ValueAsNumber": null,        "ValueAsDecimal": null,        "ValueAsDate": null,        "ReferenceObject": null      },      "ReferenceObject": null    }  ] } ```