Skip to content

Commit

Permalink
Fix: correlation attribute (#4)
Browse files Browse the repository at this point in the history
* Fix: correlation attribute

* Fix: readme was not updated
  • Loading branch information
rhouthuijzen authored May 3, 2024
1 parent c9c4b31 commit 9000e6d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ To properly setup the correlation:
| ------------------------- | --------------------------------- |
| Enable correlation | `True` |
| Person correlation field | `PersonContext.Person.ExternalId` |
| Account correlation field | `` |
| Account correlation field | `employeeId` |

> [!TIP]
> _For more information on correlation, please refer to our correlation [documentation](https://docs.helloid.com/en/provisioning/target-systems/powershell-v2-target-systems/correlation.html) pages_.
Expand All @@ -82,12 +82,12 @@ The field mapping can be imported by using the [_fieldMapping.json_](./fieldMapp

The following settings are required to connect to the API.

| Setting | Description | Mandatory |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| Client ID | The Client ID to connect with the IAM API (created when registering the App in in the Visma Developer portal). | Yes |
| Client Secret | The Client Secret to connect with the IAM API (created when registering the App in in the Visma Developer portal). | Yes |
| Tenant ID | The Tenant ID to specify to which Raet tenant to connect with the IAM API (available in the Visma Developer portal after the invitation code has been accepted). | Yes |
| UpdateOnUpdate | If you also want to update the user on a update account | |
| Setting | Description | Mandatory |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| Client ID | The Client ID to connect with the IAM API (created when registering the App in in the Visma Developer portal). | Yes |
| Client Secret | The Client Secret to connect with the IAM API (created when registering the App in in the Visma Developer portal). | Yes |
| Tenant ID | The Tenant ID to specify to which Raet tenant to connect with the IAM API (available in the Visma Developer portal after the invitation code has been accepted). | Yes |
| Only update on correlate | When enabled, the Raet Beaufort user will only be updated when the account is correlated | |

### Prerequisites

Expand Down
6 changes: 3 additions & 3 deletions create.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ try {

# Validate correlation configuration
if ($actionContext.CorrelationConfiguration.Enabled) {
$correlationField = $actionContext.CorrelationConfiguration.PersonField
$correlationValue = $actionContext.CorrelationConfiguration.PersonFieldValue
$correlationField = $actionContext.CorrelationConfiguration.accountField
$correlationValue = $actionContext.CorrelationConfiguration.accountFieldValue

if ([string]::IsNullOrEmpty($($correlationField))) {
throw 'Correlation is enabled but not configured correctly'
Expand All @@ -177,7 +177,7 @@ try {
Write-Verbose "Querying Raet Beaufort user with $($correlationField) '$($correlationValue)'"

$splatWebRequest = @{
Uri = "$($Script:BaseUri)/iam/v1.0/users(employeeId=$($correlationValue))"
Uri = "$($Script:BaseUri)/iam/v1.0/users($($correlationField)=$($correlationValue))"
Headers = $Script:AuthenticationHeaders
Method = 'GET'
ContentType = "application/json"
Expand Down
16 changes: 16 additions & 0 deletions fieldMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
"StoreInAccountData": false
}
]
},
{
"Name": "employeeId",
"Description": "[Mandatory]",
"Type": "Text",
"MappingActions": [
{
"MapForActions": [
"Create"
],
"MappingMode": "Field",
"Value": "\"Person.ExternalId\"",
"UsedInNotifications": false,
"StoreInAccountData": false
}
]
}
],
"UniqueFieldNames": []
Expand Down

0 comments on commit 9000e6d

Please sign in to comment.