Skip to content

Commit

Permalink
Added outcommented example to add boolean value if person is manager (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rschouten97 authored May 6, 2024
1 parent 3b5d0b5 commit 955b5e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions persons.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ try {
$organizationalUnits = [System.Collections.ArrayList]::new()
Get-AFASConnectorData -Token $token -BaseUri $baseUri -Connector "T4E_HelloID_OrganizationalUnits_v2" -OrderByFieldIds "ExternalId" ([ref]$organizationalUnits)

#region Example to add boolean value if person is manager (more configuration required in person loop, see below) 1/2
$managersList = ($organizationalUnits | Group-Object ManagerExternalId).name | Sort-Object -Unique
#endregion Example to add boolean value if person is manager (more configuration required in person loop, see below) 1/2

# Sort on ExternalId (to make sure the order is always the same)
$organizationalUnits = $organizationalUnits | Sort-Object -Property ExternalId

Expand Down Expand Up @@ -448,6 +452,15 @@ try {
# }
## End Group membership example (person part) 2/2

#region Example to add boolean value if person is manager 2/2
if ($managersList -contains $_.ExternalId ) {
$_ | Add-Member -MemberType NoteProperty -Name "isManager" -Value $true -Force
}
else {
$_ | Add-Member -MemberType NoteProperty -Name "isManager" -Value $false -Force
}
#endregion Example to add boolean value if person is manager 2/2

# Sanitize and export the json
$person = $_ | ConvertTo-Json -Depth 10
$person = $person.Replace("._", "__")
Expand Down

0 comments on commit 955b5e0

Please sign in to comment.