Add-Client
- 5 Minutes to read
- Print
- DarkLight
- PDF
Add-Client
- 5 Minutes to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Summary
Creates a new client.
Add-Client
-Entry
-BypassCustomFieldValidation
Returns a client object.
Parameters
Parameter | Type | Required? | Notes |
---|---|---|---|
Entry | Client Object | Yes | |
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)
# 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:
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)
# 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 = "<p>123 Drive<br />Nowhere, USA<br />55555</p>"
}
}
@{
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:
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": "<p>123 Drive<br />Nowhere, USA<br />55555</p>",
"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
}
]
}