Add-CustomObject
  • 1 Minute to read
  • Dark
    Light
  • PDF

Add-CustomObject

  • Dark
    Light
  • PDF

Article summary

Summary

Creates a new custom object entry.

Add-CustomObject
    -Entry
    -CustomObjectId

Returns a custom object entry object.

Parameters

Parameter

Type

Required?

Notes

Entry

Custom Object Entry Object

Yes


CustomObjectId

Int32

Yes

The object id.

Examples

Create a new custom object entry

# Store id of the custom object to reference later. In this case, we have a "Custodian" custom
# object that has an id of 14
$customObjectId = 14

# Create a custom object where CF_# is the custom field id for each field on the object.

# In this example:
#   CF_43 is a basic text field named "Name"
#   CF_44 is a rich text field named "Notes"
#   CF_58 is a multiple choice field named "Offices"
#   CF_97 is a date field named "Terminated On"
#   CF_98 is a media log entry reference field named "Collected Media"

$custodian = @{
    CF_43 = "Casey Copeland"
    CF_44 = "Contract ended on 12/1/2024."
    CF_58 = "MN`nCA"
    CF_97 = "2024-12-06T18:00:00.000Z"
    CF_98 = "[{`"objectId`":3,`"key`":62,`"value`":`"#62 - Flash Drive`"}]"
}

# Pass the custom object to the Add-CustomObject command to create the entry
$createdCustodian = Add-CustomObject `
    -CustomObjectId $customObjectId `
    -Entry $custodian

# Use Write-Output to log the execution results
Write-Output "Custodian $($createdCustodian.Id) ($($createdCustodian.CF_43)) was created"
Custodian 17 (Casey Copeland) was created