Skip to content

Save AcmaObject

Ryan Newington edited this page Sep 4, 2025 · 1 revision

Save-AcmaObject

Description

Saves changes made to an ACMA object back to the database. This cmdlet must be called after making any modifications to object attributes to persist the changes.

Syntax

Save-AcmaObject -AcmaObject <AcmaPSObject> [-ConstructorOverrides <string[]>] [-Events <string[]>]

Parameters

-AcmaObject

The AcmaPSObject to save to the database

Type: AcmaPSObject
Required: Yes
Position: 1
Accept pipeline input: Yes

-ConstructorOverrides

An array of constructor names or IDs to force execution, ignoring their normal execution rules

Type: String[]
Required: No
Position: 2

-Events

An array of event names to send to the object during the save operation

Type: String[]
Required: No
Position: 3

Return type

This cmdlet does not return any output

Examples

Example 1: Save basic object changes

$person = Get-AcmaObject -ObjectType "person" -AttributeName "accountName" -AttributeValue "jsmith"
$person.displayName = "John Smith"
$person.department = "IT"
Save-AcmaObject $person

Example 2: Save with constructor overrides

$person = Add-AcmaObject -ObjectClass "person"
$person.firstName = "Jane"
$person.lastName = "Doe"
Save-AcmaObject $person -ConstructorOverrides @("Generate Account Name", "Set Initial Permissions")

Example 3: Save with events

$person = Get-AcmaObject -ID "8f495b8d-799e-4eb1-9edf-dbe07fc01464"
$person.accountExpired = $true
Save-AcmaObject $person -Events @("accountExpired")

Example 4: Save using pipeline

Get-AcmaObject -ObjectType "person" -AttributeName "department" -AttributeValue "Finance" | 
    ForEach-Object { 
        $_.costCenter = "CC-FIN-001"
        Save-AcmaObject $_
    }

Notes

  • Changes to object attributes are not persisted until Save-AcmaObject is called
  • Constructor overrides will force specified constructors to run regardless of their execution rules
  • Events can be used to trigger specific business logic during the save operation
  • The cmdlet will apply all configured constructors and rules unless overridden

Clone this wiki locally