--- title: "Concepts: System Objects with Custom Fields Intro" slug: "scripting-tutorials-system-objects-with-custom-fields-intro" updated: 2024-08-26T14:52:28Z published: 2024-08-26T14:52:28Z canonical: "help.agilityblue.com/scripting-tutorials-system-objects-with-custom-fields-intro" --- > ## 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. # Concepts: System Objects with Custom Fields Intro ## Introduction This article explores the concepts behind system objects and custom fields. There are a number of system objects that allow the use of custom fields: - Clients - Matters - Media Log Entries - Volumes - Billing Entries - Contacts When a system object allows for custom fields, the paradigm for creating, reading, and updating them are the same. The object will contain their system fields on the root of the object and maintain information about custom fields and their values in a collection property named `Fields`. Each field object within the fields collection will contain metadata about the field, such as the `Label`, `DataTypeName`, and a `Value` object containing the actual values. Depending on the data type, values are stored in properties that start with `ValueAs*` where the asterisk here indicates the type (string, date, number, etc.). If the data type is a reference field, there is an object property named `ReferenceObject` that stores the reference values for the field. Here’s an example of a client object instance where there are 3 custom fields defined on the client object: ```plaintext PowerShell Script to retrieve the subsquent result: Get-Client -Id 3 | ConvertTo-Json -Depth 10 { "ClientId": 3, "Name": "Alpha Widgets", "Reference": "1032", "Active": false, ... Some read-only system fields are removed for readability ... "Fields": [ { "FieldId": 10, "ObjectId": 1, "DataTypeId": 1, "DataTypeName": "Basic Text", "Label": "Billing Contact Name", "IsRequired": true, "Position": 0, "Guid": 1475776072753, "IsSystemField": false, "IsReferenceValue": false, "DefaultValue": null, "CopyPreviousValueOnSaveAndNew": false, "Value": { "ObjectFieldValueId": 92, "ObjectFieldId": 10, "ObjectId": 1, "PrimaryKeyId": 3, "ValueAsString": "Joseph Mauer", "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": 2, "Guid": 1476994440044, "IsSystemField": false, "IsReferenceValue": false, "DefaultValue": null, "CopyPreviousValueOnSaveAndNew": false, "Value": { "ObjectFieldValueId": 95, "ObjectFieldId": 14, "ObjectId": 1, "PrimaryKeyId": 3, "ValueAsString": "
1600 Puckett Drive N
Minneapolis, MN 55402
", "ValueAsBoolean": null, "ValueAsNumber": null, "ValueAsDecimal": null, "ValueAsDate": null, "ReferenceObject": null }, "ReferenceObject": null }, { "FieldId": 21, "ObjectId": 1, "DataTypeId": 1, "DataTypeName": "Basic Text", "Label": "Billing Contact Email", "IsRequired": true, "Position": 1, "Guid": 1500308948435, "IsSystemField": false, "IsReferenceValue": false, "DefaultValue": null, "CopyPreviousValueOnSaveAndNew": false, "Value": { "ObjectFieldValueId": 94, "ObjectFieldId": 21, "ObjectId": 1, "PrimaryKeyId": 3, "ValueAsString": "jmauer@alphawidgets.com", "ValueAsBoolean": null, "ValueAsNumber": null, "ValueAsDecimal": null, "ValueAsDate": null, "ReferenceObject": null }, "ReferenceObject": null } ] } ``` **Points of Interest**: - You will notice that each custom field within the `Fields` property have the same structure where there is first metadata about a field, then there is a `Value` object property that contains values and a `ReferenceObject` if the data type is “Reference”. - The metadata information about a field can help you determine the different data types, determining which `ValueAs*` property to store the value in. Here are the 10 different data types: | Data Type Id | Data Type Name | Stored As | | --- | --- | --- | | 1 | Basic Text | ValueAsString | | 2 | Rich Text* | ValueAsString | | 3 | Whole Number | ValueAsNumber | | 4 | Decimal Number | ValueAsDecimal | | 5 | Yes or No Choice | ValueAsBoolean | | 6 | Date Only | ValueAsDate | | 7 | Date and Time | ValueAsDate | | 8 | Single Choice | ValueAsString | | 9 | Multiple Choice** | ValueAsString | | 10 | Reference | ReferenceObject | *Note that rich text fields save data with HTML markup so the browser can format the value properly. The HTML that is accepted is limited for security reasons and Agility Blue will ignore executing