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

Set-CustomObject

  • Dark
    Light
  • PDF

Article summary

Summary

Updates an existing custom object entry.

Set-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

Update an existing 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

# Update 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_98 is a media log entry reference field named "Collected Media"

# Retrieve an existing custom object using the Get-CustomObject cmdlet
$custodian = Get-CustomObject -CustomObjectId $customObjectId -Id 17

# Change some properties
$custodian.CF_44 = "Contract ended on 12/1/2024."
$custodian.CF_98 = "[{`"objectId`":3,`"key`":62,`"value`":`"#62 - Flash Drive`"}]"

# Update the billing type using the Set-CustomObject cmdlet
$updatedCustodian = Set-CustomObject `
    -CustomObjectId $customObjectId `
    -Entry $custodian

# Output a message to the execution log
Write-Output "Updated custodian $($updatedCustodian.Id) ($($updatedCustodian.CF_43))"
Updated custodian 17 (Casey Copeland)