Post-action scripts
For more information, see Post-actions and AD target system variable reference.
Warning
All your API calls must be wrapped in the script's if (-Not($dryRun -eq $true)) { } block. Otherwise, your production code will run during script previews.
There are five post-action account scripts. In each script, you get $person, $manager, $accountReference, $managerAccountReference, and $entitlementContext ($eRef). Use them to make API calls into the AD target system.
Any output of the script must be returned in $result. Use ExportData to write account values back to HelloID. For example:
$eRef = $entitlementContext | ConvertFrom-Json
$ExportData = [Collections.Generic.List[PSCustomObject]]::new()
$ExportData = $eref.ExportData
$auditLogs = [Collections.Generic.List[PSCustomObject]]::new()
if (-Not($dryRun -eq $true)) {
#change a property
$ExportData.userPrincipalName = "[email protected]"
#add a property
$ExportData | Add-Member -MemberType NoteProperty -Name "ExampleProperty" -Value $value -Force
$success = $true
$result = [PSCustomObject]@{
Success = $success
AuditLogs = $auditLogs
ExportData = $exportData
}
$auditLogs.Add([PSCustomObject]@{
Message = "Updated account details"
IsError = $false
}
)Note
HelloID stores ExportData fields in a case-sensitive JSON format. Using the wrong capitalization (for example, displayName instead of DisplayName) can cause errors.
Account Create post-action script
Runs after each Account Grant entitlement action. Note that mailbox creation and home directory creation are part of that entitlement action, if you've set up the Exchange and Directories features.
Account Enable post-action script
Runs after each Account Access Grant entitlement action.
Account Update post-action script
Account Disable post-action script
Runs after each Account Access Revoke entitlement action.