Get-Client
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Get-Client

  • Dark
    Light
  • PDF

Article summary

Summary

Retrieves an existing client.

Get-Client
    -Id

Returns a client object.

Parameters

ParameterTypeRequired?Notes
IdInt32YesThe client id.

Examples

Get an existing client

This example retrieves a specific client and outputs it as JSON.

# Retrieve a specific client by id
$data = Get-Client -Id 1

Write-Output "Retrieved client $($data.ClientId) ($($data.Name))"

# Convert the data to output as JSON
$jsonOutput = $data | ConvertTo-Json -Depth 10

# 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

Write-Output $jsonOutput

Results of executing the script:

Retrieved client 1 (ABC Inc.)

JSON Results:
{
  "ClientId": 1,
  "Name": "ABC Inc.",
  "Reference": "00001",
  "Active": true,
  "IsFavorite": false,
  "NumberOfMatters": 5,
  "NumberOfProjects": 22,
  "NumberOfTasks": 26,
  "NumberOfMediaLogEntries": 2,
  "NumberOfVolumes": 2,
  "NumberOfBillingEntries": 17,
  "NumberOfComments": 0,
  "FirstProjectCreatedOnDate": "2015-08-26T16:39:48.3538378-05:00",
  "LastProjectCreatedOnDate": "2023-11-02T19:39:25.3064647+00:00",
  "CreatedByFullName": "Service Account",
  "CreatedById": "410e109b-6ff5-4442-9670-cd5e3cd82a7f",
  "CreatedOn": "2015-08-26T16:38:10.7802197-05:00",
  "CreatedBy": null,
  "LastUpdatedByFullName": "Service Account",
  "LastUpdatedById": "410e109b-6ff5-4442-9670-cd5e3cd82a7f",
  "LastUpdatedOn": "2023-12-04T15:46:17.9173887+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": 1178,
        "ObjectFieldId": 10,
        "ObjectId": 1,
        "PrimaryKeyId": 1,
        "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": 1179,
        "ObjectFieldId": 14,
        "ObjectId": 1,
        "PrimaryKeyId": 1,
        "ValueAsString": null,
        "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": 1180,
        "ObjectFieldId": 20,
        "ObjectId": 1,
        "PrimaryKeyId": 1,
        "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": 1181,
        "ObjectFieldId": 21,
        "ObjectId": 1,
        "PrimaryKeyId": 1,
        "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": 1182,
        "ObjectFieldId": 27,
        "ObjectId": 1,
        "PrimaryKeyId": 1,
        "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": 1183,
        "ObjectFieldId": 55,
        "ObjectId": 1,
        "PrimaryKeyId": 1,
        "ValueAsString": null,
        "ValueAsBoolean": null,
        "ValueAsNumber": null,
        "ValueAsDecimal": null,
        "ValueAsDate": null,
        "ReferenceObject": {
          "ObjectFieldReferenceObjectInstanceId": 7,
          "ObjectFieldValueId": 1183,
          "ObjectId": 8,
          "Object": null,
          "PrimaryObjectId": 1,
          "PrimaryKeyId": 1,
          "KeyType": "String",
          "DisplayFormat": "%Val%",
          "IsSystemObject": true,
          "Name": null,
          "NumberOfValues": 1,
          "Values": [
            {
              "ObjectFieldReferenceObjectInstanceValueId": 11,
              "ObjectFieldReferenceObjectInstanceId": 7,
              "KeyAsString": "2c35e3b4-2e17-4ee6-b192-e92e4db5cf3c",
              "KeyAsInteger": null,
              "KeyAsLong": null,
              "Value": "Roger Schlachter"
            }
          ]
        }
      },
      "ReferenceObject": null
    }
  ]
}

What's Next