diff --git a/CHANGELOG.md b/CHANGELOG.md
index 40a9eee..45ea209 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
+## [3.5.0] - 02-03-2026
+
+List of changes:
+- Added `SkipAssetsFound` option for change and incident notifications to skip creating a TOPdesk change/incident when one or multiple assets are found
+- Updated change and incident grant/revoke scripts to support the new skip flow and improved action-skip audit logging
+- Updated example permission JSON files for change and incident with `SkipAssetsFound` configuration
+- Updated documentation (`README.md`) with the new asset-skip behavior and refreshed connector setup/reference sections
+
## [3.4.3] - 06-02-2026
List of changes:
diff --git a/README.md b/README.md
index 9c5f836..4de2eaa 100644
--- a/README.md
+++ b/README.md
@@ -15,69 +15,34 @@
- [Introduction](#introduction)
- [Getting started](#getting-started)
- [HelloID Icon URL](#helloid-icon-url)
- - [Provisioning PowerShell V2 connector](#provisioning-powershell-v2-connector)
+ - [Requirements](#requirements)
+ - [Connection settings](#connection-settings)
- [Correlation configuration](#correlation-configuration)
- [Field mapping](#field-mapping)
- - [Connection settings](#connection-settings)
- - [Prerequisites](#prerequisites)
- - [Remarks](#remarks)
+ - [Account Reference](#account-reference)
+ - [Remarks](#remarks)
- [Setup the connector](#setup-the-connector)
- [Remove attributes when updating a Topdesk person instead of correlating](#remove-attributes-when-updating-a-topdesk-person-instead-of-correlating)
- [Disable department, budgetholder or manager](#disable-department-budgetholder-or-manager)
- [Changes](#changes)
- [Incidents](#incidents)
+ - [Development resources](#development-resources)
+ - [API endpoints](#api-endpoints)
+ - [API documentation](#api-documentation)
- [Getting help](#getting-help)
- [HelloID docs](#helloid-docs)
## Introduction
Supported features:
-| Feature | Supported | Actions | Remarks |
-| ----------------------------------------- | --------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
-| **Account Lifecycle** | ✅ | Create, Update, Enable, Disable, Delete | |
-| **Permissions** | ✅ | Retrieve, Grant, Revoke | Creating changes and incidents |
-| **Resources** | ✅ | - | |
-| **Entitlement Import: Accounts** | ✅ | - | |
-| **Entitlement Import: Permissions** | ❌ | - | |
-| **Governance Reconciliation Resolutions** | ✅ | Disable, Delete | Delete is treated as a disable action with the option to update values. Please adjust the configuration accordingly in the delete script |
-
-_HelloID-Conn-Prov-Target-Topdesk_ is a _target_ connector. Topdesk provides a set of REST APIs that allow you to programmatically interact with its data. The [Topdesk API documentation](https://developers.topdesk.com/explorer/?page=supporting-files#/) provides details of API commands that are used.
-
-| Endpoint | Description |
-| ---------------------------------- | ---------------------------------------------------------- |
-| /tas/api/persons | `GET / POST / PATCH` actions to read and write the persons |
-| /tas/api/branches | `GET / POST` read and create branches |
-| /tas/api/departments | `GET / POST` read and create departments |
-| /tas/api/budgetholders | `GET / POST` read and create budgetholders |
-| /tas/api/archiving-reasons | `GET` archiving-reasons to archive persons |
-| /tas/api/applicableChangeTemplates | `GET` read change template from Topdesk |
-| /tas/api/operatorChanges | `POST` create changes in Topdesk |
-| /tas/api/incidents | `GET / POST` read and create incidents |
-| /tas/api/operatorgroups | `GET` read operator groups used for incidents |
-| /tas/api/operators | `GET` read operators used for incidents |
-| /tas/api/countries | `GET` read countries used for create branches |
-| /tas/api/assetmgmt | `GET` read assets used for reading linked assets to person |
-
-The following lifecycle actions are available:
-
-| Action | Description |
-| -------------------------- | ---------------------------------------------------------------------------- |
-| create.ps1 | PowerShell _create_ or _correlate_ lifecycle action |
-| delete.ps1 | PowerShell _delete_ lifecycle action (empty configured values and archive) |
-| disable.ps1 | PowerShell _disable_ lifecycle action |
-| enable.ps1 | PowerShell _enable_ lifecycle action |
-| update.ps1 | PowerShell _update_ lifecycle action |
-| grant.change.ps1 | PowerShell _grant_ lifecycle action (create change on entitlement grant) |
-| revoke.change.ps1 | PowerShell _revoke_ lifecycle action (create change on entitlement revoke) |
-| permissions.change.ps1 | PowerShell _permissions_ lifecycle action (read configured change.json) |
-| grant.incident.ps1 | PowerShell _grant_ lifecycle action (create incident on entitlement grant) |
-| revoke.incident.ps1 | PowerShell _revoke_ lifecycle action (create incident on entitlement revoke) |
-| permissions.incident.ps1 | PowerShell _permissions_ lifecycle action (read configured incident.json) |
-| resources.branch.ps1 | PowerShell _resources_ lifecycle action (create braches) |
-| resources.department.ps1 | PowerShell _resources_ lifecycle action (create departments) |
-| resources.budgetholder.ps1 | PowerShell _resources_ lifecycle action (create budgetholders) |
-| configuration.json | Default _configuration.json_ |
-| fieldMapping.json | Default _fieldMapping.json_ |
+| Feature | Supported | Actions | Remarks |
+| ----------------------------------------- | --------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| **Account Lifecycle** | ✅ | Create, Update, Enable, Disable, Delete | |
+| **Permissions** | ✅ | Retrieve, Grant, Revoke | Creating changes and incidents |
+| **Resources** | ✅ | - | |
+| **Entitlement Import: Accounts** | ✅ | - | |
+| **Entitlement Import: Permissions** | ❌ | | |
+| **Governance Reconciliation Resolutions** | ✅ | Disable, Delete, Revoke | Delete is treated as a disable action with the option to update values. Please adjust the configuration accordingly in the delete script. Revoke only avalible for the software assignments permission |
## Getting started
@@ -88,7 +53,68 @@ URL of the icon used for the HelloID Provisioning target system.
https://raw.githubusercontent.com/Tools4everBV/HelloID-Conn-Prov-Target-Topdesk/refs/heads/main/Icon.png
```
-### Provisioning PowerShell V2 connector
+### Requirements
+> [!IMPORTANT]
+> When changes or incidents are in scope, a helloID agent on-premise is required. For cloud only changes or incidents use the [HelloID Topdesk notification system](https://github.com/Tools4everBV/HelloID-Conn-Prov-Notification-Topdesk)
+
+an archiving reason that is configured in Topdesk.
+Credentials with the rights listed below.
+
+| Permission | Read | Write | Create | Archive |
+| -------------------------------- | ---- | ----- | ------ | ------- |
+| Call Management | | | | |
+| First line calls | x | x | x | |
+| Second line calls | x | x | x | |
+| Escalate calls | | x | | |
+| Link object to call | | x | | |
+| Link room to call | | x | | |
+| Change Management | | | | |
+| Requests for Simple Change | x | x | x | |
+| Requests for Extensive Change | x | x | x | |
+| Simple Changes | x | x | | |
+| Extensive Changes | x | x | | |
+| New Asset Management | | | | |
+| Templates | x | | | |
+| Supporting Files | | | | |
+| Persons | x | x | x | x |
+| Operators | x | x | x | x |
+| Operator groups | x | | | |
+| Suppliers | x | | | |
+| Rooms | x | | | |
+| Login data | | x | | |
+| Supporting Files Settings | x | x | | |
+| Reporting API | | | | |
+| REST API | x | | | |
+| Use application passwords | | x | | |
+| Asset Management - Assets | | | | |
+| Configuration | x | | | |
+| Firsttemplate | x | | | |
+| Hardware | x | | | |
+| Inventories | x | | | |
+| Licentie | x | | | |
+| Network component | x | | | |
+| Software | x | | | |
+| Stock | x | | | |
+| Telephone systems | x | | | |
+
+> [!NOTE]
+> It is possible to set filters in Topdesk. If you don't get a result from Topdesk when expecting one it is probably because filters are used. For example, searching for a branch that can't be found by the API user but is visible in Topdesk.
+
+### Connection settings
+
+The following settings are required to connect to the API.
+
+| Setting | Description | Mandatory |
+| ----------------------------------- | ---------------------------------------------------------------------------------------------------- | --------- |
+| BaseUrl | The URL to the API | Yes |
+| UserName | The UserName to connect to the API | Yes |
+| Password | The Password to connect to the API | Yes |
+| Notification file path | Location of the JSON file needed for changes or incidents | |
+| Archiving reason | Fill in an archiving reason that is configured in Topdesk | Yes |
+| Fallback email | When a manager is set as the requester (in the JSON file) but the manager account reference is empty | |
+| Do not create changes or incidents | If enabled no changes or incidents will be created in Topdesk | |
+| When no department in source data | Stop processing and generate an error or clear the department field in Topdesk | Yes |
+| When no budgetholder in source data | Stop processing and generate an error or clear the budgetholder field in Topdesk | Yes |
#### Correlation configuration
@@ -119,73 +145,11 @@ The field mapping can be imported by using the [_fieldMapping.json_](./fieldMapp
> [!TIP]
> You can add extra fields to the account mapping. For example `mobileNumber` or a boolean field `showAllBranches`. For all possible options please check the [Topdesk API documentation](https://developers.topdesk.com/explorer/?page=supporting-files#/)
-### Connection settings
+### Account Reference
-The following settings are required to connect to the API.
+The account reference is populated with the property `id` property from _HelloID-Conn-Prov-Target-Topdesk_
-| Setting | Description | Mandatory |
-| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------- |
-| BaseUrl | The URL to the API | Yes |
-| UserName | The UserName to connect to the API | Yes |
-| Password | The Password to connect to the API | Yes |
-| Notification file path | Location of the JSON file needed for changes or incidents | |
-| Archiving reason | Fill in an archiving reason that is configured in Topdesk | Yes |
-| Fallback email | When a manager is set as the requester (in the JSON file) but the manager account reference is empty | |
-| Do not create changes or incidents | If enabled no changes or incidents will be created in Topdesk | |
-| When no item is found in Topdesk | Stop processing and generate an error or keep the current value and continue if budgetHolder or Department is not found | Yes |
-| When no department in source data | Stop processing and generate an error or clear the department field in Topdesk | Yes |
-| When no budgetholder in source data | Stop processing and generate an error or clear the budgetholder field in Topdesk | Yes |
-| Toggle debug logging | Creates extra logging for debug purposes |
-
-### Prerequisites
-> [!IMPORTANT]
-> When changes or incidents are in scope, a helloID agent on-premise is required. For cloud only changes or incidents use the [HelloID Topdesk notification system](https://github.com/Tools4everBV/HelloID-Conn-Prov-Notification-Topdesk)
-
-an archiving reason that is configured in Topdesk.
-Credentials with the rights listed below.
-
-| Permission | Read | Write | Create | Archive |
-| -------------------------------- | ---- | ----- | ------ | ------- |
-| Call Management |
-| First line calls | x | x | x |
-| Second line calls | x | x | x |
-| Escalate calls | | x | |
-| Link object to call | | x | |
-| Link room to call | | x | |
-| Change Management |
-| Requests for Simple Change | x | x | x |
-| Requests for Extensive Change | x | x | x |
-| Simple Changes | x | x | |
-| Extensive Changes | x | x | |
-| New Asset Management |
-| Templates | x | | |
-| Supporting Files |
-| Persons | x | x | x | x |
-| Operators | x | x | x | x |
-| Operator groups | x | | |
-| Suppliers | x | | |
-| Rooms | x | | |
-| Login data | | x | |
-| Supporting Files Settings | x | x | | |
-| Reporting API |
-| REST API | x | | |
-| Use application passwords | | x | |
-| Asset Management - Assets |
-| Configuration | x | | | |
-| Firsttemplate | x | | | |
-| Hardware | x | | | |
-| Inventories | x | | | |
-| Licentie | x | | | |
-| Network component | x | | | |
-| Software | x | | | |
-| Stock | x | | | |
-| Telephone systems | x | | | |
-
-> [!NOTE]
-> It is possible to set filters in Topdesk. If you don't get a result from Topdesk when expecting one it is probably because filters are used. For example, searching for a branch that can't be found by the API user but is visible in Topdesk.
-
-
-### Remarks
+## Remarks
## Setup the connector
@@ -256,8 +220,9 @@ The change JSON file has the following structure:
"Impact": "Persoon",
"Benefit": null,
"Priority": "P1",
- "EnableGetAssets": false,
+ "EnableGetAssets": true,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": true,
"AssetsFilter": ""
},
"Revoke": {
@@ -274,6 +239,7 @@ The change JSON file has the following structure:
"Priority": "P1",
"EnableGetAssets": true,
"SkipNoAssetsFound": true,
+ "SkipAssetsFound": false,
"AssetsFilter": "Hardware,Software"
}
}
@@ -297,6 +263,7 @@ The change JSON file has the following structure:
| Priority: | Commonly filled in the Topdesk change template. If so use null. |
| EnableGetAssets: | Set this value `true` for querying the assets that are linked to the person. |
| SkipNoAssetsFound: | Set this value `true` if no change must be created when no asset is found. |
+| SkipAssetsFound: | Set this value `true` if no change must be created when one or multiple asset(s) are found. |
| AssetsFilter: | For the type of assets that need to be queried. Use `,` between the types when querying more than one. Beware that the values are case-sensitive. Leave empty to query all assets. |
### Incidents
@@ -366,8 +333,9 @@ The incident JSON file has the following structure:
"EntryType": null,
"Urgency": null,
"ProcessingStatus": null,
- "EnableGetAssets": false,
+ "EnableGetAssets": true,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": true,
"AssetsFilter": ""
},
"Revoke": {
@@ -390,6 +358,7 @@ The incident JSON file has the following structure:
"ProcessingStatus": null,
"EnableGetAssets": true,
"SkipNoAssetsFound": true,
+ "SkipAssetsFound": false,
"AssetsFilter": "Hardware,Software"
}
}
@@ -418,16 +387,39 @@ The incident JSON file has the following structure:
| ProcessingStatus: | Fill in the processing status name that is used in Topdesk. It is possible to disable this lookup field by using the value null. If marked mandatory in Topdesk this will be shown when opening the incident. With the correct processing status, it is possible to create a closed incident. |
| EnableGetAssets: | Set this value `true` for querying the assets that are linked to the person. |
| SkipNoAssetsFound: | Set this value `true` if no incident must be created when no asset is found. |
+| SkipAssetsFound: | Set this value `true` if no incident must be created when one or multiple asset(s) are found. |
| AssetsFilter: | For the type of assets that need to be queried. Use `,` between the types when querying more than one. Beware that the values are case-sensitive. Leave empty to query all assets. |
+## Development resources
+
+### API endpoints
+
+The following endpoints are used by the connector
+
+| Endpoint | Description |
+| ---------------------------------- | ---------------------------------------------------------- |
+| /tas/api/persons | `GET / POST / PATCH` actions to read and write the persons |
+| /tas/api/branches | `GET / POST` read and create branches |
+| /tas/api/departments | `GET / POST` read and create departments |
+| /tas/api/budgetholders | `GET / POST` read and create budgetholders |
+| /tas/api/archiving-reasons | `GET` archiving-reasons to archive persons |
+| /tas/api/applicableChangeTemplates | `GET` read change template from Topdesk |
+| /tas/api/operatorChanges | `POST` create changes in Topdesk |
+| /tas/api/incidents | `GET / POST` read and create incidents |
+| /tas/api/operatorgroups | `GET` read operator groups used for incidents |
+| /tas/api/operators | `GET` read operators used for incidents |
+| /tas/api/countries | `GET` read countries used for create branches |
+| /tas/api/assetmgmt | `GET` for reading linked assets* |
+
+### API documentation
+
+_HelloID-Conn-Prov-Target-Topdesk_ is a _target_ connector. Topdesk provides a set of REST APIs that allow you to programmatically interact with its data. The [Topdesk API documentation](https://developers.topdesk.com/explorer/?page=supporting-files#/) provides details of API commands that are used.
+
## Getting help
> [!TIP]
> _For more information on how to configure a HelloID PowerShell connector, please refer to our [documentation](https://docs.helloid.com/en/provisioning/target-systems/powershell-v2-target-systems.html) pages_.
-> [!TIP]
-> _If you need help, feel free to ask questions on our [forum](https://forum.helloid.com/forum/helloid-connectors/provisioning/1266-helloid-conn-prov-target-topdesk)._
-
## HelloID docs
The official HelloID documentation can be found at: https://docs.helloid.com/
diff --git a/configuration.json b/configuration.json
index 16541b2..c5037d9 100644
--- a/configuration.json
+++ b/configuration.json
@@ -90,7 +90,7 @@
"value": "true",
"label": "Stop processing and generate an error"
},
- {
+ {
"value": "false",
"label": "Clear the department field in Topdesk"
}
diff --git a/permissions/change/example.change.json b/permissions/change/example.change.json
index a8b9225..3b8fe06 100644
--- a/permissions/change/example.change.json
+++ b/permissions/change/example.change.json
@@ -18,6 +18,7 @@
"Priority": "P1",
"EnableGetAssets": true,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": true,
"AssetsFilter": "Hardware,Software"
},
"Revoke": {
@@ -34,6 +35,7 @@
"Priority": "P1",
"EnableGetAssets": true,
"SkipNoAssetsFound": true,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
}
},
@@ -56,6 +58,7 @@
"Priority": "P1",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {
@@ -72,6 +75,7 @@
"Priority": "P1",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
}
},
@@ -94,6 +98,7 @@
"Priority": null,
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {}
@@ -118,6 +123,7 @@
"Priority": null,
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
}
}
diff --git a/permissions/change/grantPermission.ps1 b/permissions/change/grantPermission.ps1
index 99e2214..5ca1b7e 100644
--- a/permissions/change/grantPermission.ps1
+++ b/permissions/change/grantPermission.ps1
@@ -594,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {
[Parameter()]
[Boolean]
- $SkipNoAssets
+ $SkipNoAssets,
+
+ [Parameter()]
+ [Boolean]
+ $SkipAssetsFound
)
if ($AssetFilter) {
@@ -640,7 +644,7 @@ function Get-TopdeskAssetsByPersonId {
if ([string]::IsNullOrEmpty($assetList)) {
if ($SkipNoAssets) {
Write-Information 'Action skipped because no assets are found and [SkipNoAssetsFound = true] is configured'
- return
+ throw 'Action skip [SkipNoAssetsFound]'
}
else {
# no results found
@@ -648,6 +652,10 @@ function Get-TopdeskAssetsByPersonId {
$assetList = "- $defaultMessage`n"
}
}
+ elseif ($SkipAssetsFound) {
+ Write-Information "Action skipped because assets are found and [SkipAssetsFound = true] is configured [$($assetList)]"
+ throw 'Action skip [SkipAssetsFound]'
+ }
write-output $assetList
}
#endregion
@@ -705,20 +713,16 @@ try {
# get assets of employee
$splatParamsTopdeskAssets = @{
- PersonId = $actionContext.References.Account
- Headers = $authHeaders
- BaseUrl = $actionContext.Configuration.baseUrl
- AssetFilter = $templateFilters
- SkipNoAssets = [boolean]$template.SkipNoAssetsFound
+ PersonId = $actionContext.References.Account
+ Headers = $authHeaders
+ BaseUrl = $actionContext.Configuration.baseUrl
+ AssetFilter = $templateFilters
+ SkipNoAssets = [boolean]$template.SkipNoAssetsFound
+ SkipAssetsFound = [boolean]$template.SkipAssetsFound
}
# Use $($account.TopdeskAssets) in your notification configuration to resolve the queried assets
$account.TopdeskAssets = Get-TopdeskAssetsByPersonId @splatParamsTopdeskAssets
-
- # TopdeskAssets can only be empty if the action needs to be skipped [SkipNoAssetsFound = true]
- if ([string]::IsNullOrEmpty($account.TopdeskAssets)) {
- throw 'Action skip'
- }
}
# Resolve variables in the BriefDescription field
@@ -945,7 +949,7 @@ catch {
# Only log when there are no lookup values, as these generate their own audit message
}
- 'Action skip' {
+ 'Action skip [SkipNoAssetsFound]' {
# If empty and [SkipNoAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
Message = 'Not creating Topdesk change, because no assets are found and [SkipNoAssetsFound = true] is configured'
@@ -953,6 +957,14 @@ catch {
})
}
+ 'Action skip [SkipAssetsFound]' {
+ # If not empty and [SkipAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
+ $outputContext.AuditLogs.Add([PSCustomObject]@{
+ Message = 'Not creating Topdesk change, because assets are found and [SkipAssetsFound = true] is configured'
+ IsError = $false
+ })
+ }
+
'Notifications are disabled' {
# Don't do anything when notifications are disabled, mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
@@ -980,4 +992,4 @@ finally {
if ($outputContext.AuditLogs.IsError -notContains $true) {
$outputContext.Success = $true
}
-}
+}
\ No newline at end of file
diff --git a/permissions/change/revokePermission.ps1 b/permissions/change/revokePermission.ps1
index 3c1640c..1dc745c 100644
--- a/permissions/change/revokePermission.ps1
+++ b/permissions/change/revokePermission.ps1
@@ -312,7 +312,6 @@ function Get-TopdeskRequesterByType {
# Validate employee entry
if ($type -eq 'manager') {
- Write-Information "Type: Manager $([string]::IsNullOrEmpty($managerAccountReference))"
if ([string]::IsNullOrEmpty($managerAccountReference)) {
Write-Information "Type: Manager - managerAccountReference empty"
if ([string]::IsNullOrEmpty($managerFallback)) {
@@ -595,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {
[Parameter()]
[Boolean]
- $SkipNoAssets
+ $SkipNoAssets,
+
+ [Parameter()]
+ [Boolean]
+ $SkipAssetsFound
)
if ($AssetFilter) {
@@ -641,7 +644,7 @@ function Get-TopdeskAssetsByPersonId {
if ([string]::IsNullOrEmpty($assetList)) {
if ($SkipNoAssets) {
Write-Information 'Action skipped because no assets are found and [SkipNoAssetsFound = true] is configured'
- return
+ throw 'Action skip [SkipNoAssetsFound]'
}
else {
# no results found
@@ -649,6 +652,10 @@ function Get-TopdeskAssetsByPersonId {
$assetList = "- $defaultMessage`n"
}
}
+ elseif ($SkipAssetsFound) {
+ Write-Information "Action skipped because assets are found and [SkipAssetsFound = true] is configured [$($assetList)]"
+ throw 'Action skip [SkipAssetsFound]'
+ }
write-output $assetList
}
#endregion
@@ -706,20 +713,16 @@ try {
# get assets of employee
$splatParamsTopdeskAssets = @{
- PersonId = $actionContext.References.Account
- Headers = $authHeaders
- BaseUrl = $actionContext.Configuration.baseUrl
- AssetFilter = $templateFilters
- SkipNoAssets = [boolean]$template.SkipNoAssetsFound
+ PersonId = $actionContext.References.Account
+ Headers = $authHeaders
+ BaseUrl = $actionContext.Configuration.baseUrl
+ AssetFilter = $templateFilters
+ SkipNoAssets = [boolean]$template.SkipNoAssetsFound
+ SkipAssetsFound = [boolean]$template.SkipAssetsFound
}
# Use $($account.TopdeskAssets) in your notification configuration to resolve the queried assets
$account.TopdeskAssets = Get-TopdeskAssetsByPersonId @splatParamsTopdeskAssets
-
- # TopdeskAssets can only be empty if the action needs to be skipped [SkipNoAssetsFound = true]
- if ([string]::IsNullOrEmpty($account.TopdeskAssets)) {
- throw 'Action skip'
- }
}
# Resolve variables in the BriefDescription field
@@ -946,7 +949,7 @@ catch {
# Only log when there are no lookup values, as these generate their own audit message
}
- 'Action skip' {
+ 'Action skip [SkipNoAssetsFound]' {
# If empty and [SkipNoAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
Message = 'Not creating Topdesk change, because no assets are found and [SkipNoAssetsFound = true] is configured'
@@ -954,6 +957,14 @@ catch {
})
}
+ 'Action skip [SkipAssetsFound]' {
+ # If not empty and [SkipAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
+ $outputContext.AuditLogs.Add([PSCustomObject]@{
+ Message = 'Not creating Topdesk change, because assets are found and [SkipAssetsFound = true] is configured'
+ IsError = $false
+ })
+ }
+
'Notifications are disabled' {
# Don't do anything when notifications are disabled, mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
@@ -981,4 +992,4 @@ finally {
if ($outputContext.AuditLogs.IsError -notContains $true) {
$outputContext.Success = $true
}
-}
+}
\ No newline at end of file
diff --git a/permissions/incident/example.incident.json b/permissions/incident/example.incident.json
index 5b836fc..dfbca68 100644
--- a/permissions/incident/example.incident.json
+++ b/permissions/incident/example.incident.json
@@ -24,6 +24,7 @@
"ProcessingStatus": null,
"EnableGetAssets": true,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": true,
"AssetsFilter": "Hardware,Software"
},
"Revoke": {
@@ -46,6 +47,7 @@
"ProcessingStatus": null,
"EnableGetAssets": true,
"SkipNoAssetsFound": true,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
}
},
@@ -74,6 +76,7 @@
"ProcessingStatus": null,
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {
@@ -96,6 +99,7 @@
"ProcessingStatus": "Geregistreerd",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
}
},
@@ -124,6 +128,7 @@
"ProcessingStatus": "Geregistreerd",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {}
@@ -154,6 +159,7 @@
"ProcessingStatus": "Geregistreerd",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
+ "SkipAssetsFound": false,
"AssetsFilter": ""
}
}
diff --git a/permissions/incident/grantPermission.ps1 b/permissions/incident/grantPermission.ps1
index dea4a84..d0f448d 100644
--- a/permissions/incident/grantPermission.ps1
+++ b/permissions/incident/grantPermission.ps1
@@ -594,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {
[Parameter()]
[Boolean]
- $SkipNoAssets
+ $SkipNoAssets,
+
+ [Parameter()]
+ [Boolean]
+ $SkipAssetsFound
)
# Check if the correlationAttribute is not empty
@@ -650,7 +654,7 @@ function Get-TopdeskAssetsByPersonId {
if ([string]::IsNullOrEmpty($assetList)) {
if ($SkipNoAssets) {
Write-Information 'Action skipped because no assets are found and [SkipNoAssetsFound = true] is configured'
- return
+ throw 'Action skip [SkipNoAssetsFound]'
}
else {
# no results found
@@ -658,6 +662,10 @@ function Get-TopdeskAssetsByPersonId {
$assetList = "- $defaultMessage
"
}
}
+ elseif ($SkipAssetsFound) {
+ Write-Information "Action skipped because assets are found and [SkipAssetsFound = true] is configured [$($assetList)]"
+ throw 'Action skip [SkipAssetsFound]'
+ }
write-output $assetList
}
#endregion
@@ -727,11 +735,6 @@ try {
# Use $($account.TopdeskAssets) in your notification configuration to resolve the queried assets
$account.TopdeskAssets = Get-TopdeskAssetsByPersonId @splatParamsTopdeskAssets
-
- # TopdeskAssets can only be empty if the action needs to be skipped [SkipNoAssetsFound = true]
- if ([string]::IsNullOrEmpty($account.TopdeskAssets)) {
- throw 'Action skip'
- }
}
# Resolve variables in the RequestShort field
@@ -1120,14 +1123,22 @@ catch {
# Only log when there are no lookup values, as these generate their own audit message
}
- 'Action skip' {
+ 'Action skip [SkipNoAssetsFound]' {
# If empty and [SkipNoAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
- Message = 'Not creating Topdesk incident, because no assets are found and [SkipNoAssetsFound = true] is configured'
+ Message = 'Not creating Topdesk change, because no assets are found and [SkipNoAssetsFound = true] is configured'
IsError = $false
})
}
+ 'Action skip [SkipAssetsFound]' {
+ # If not empty and [SkipAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
+ $outputContext.AuditLogs.Add([PSCustomObject]@{
+ Message = 'Not creating Topdesk change, because assets are found and [SkipAssetsFound = true] is configured'
+ IsError = $false
+ })
+ }
+
'Notifications are disabled' {
# Don't do anything when notifications are disabled, mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
diff --git a/permissions/incident/revokePermission.ps1 b/permissions/incident/revokePermission.ps1
index e18dbb3..8ea44f8 100644
--- a/permissions/incident/revokePermission.ps1
+++ b/permissions/incident/revokePermission.ps1
@@ -594,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {
[Parameter()]
[Boolean]
- $SkipNoAssets
+ $SkipNoAssets,
+
+ [Parameter()]
+ [Boolean]
+ $SkipAssetsFound
)
# Check if the correlationAttribute is not empty
@@ -650,7 +654,7 @@ function Get-TopdeskAssetsByPersonId {
if ([string]::IsNullOrEmpty($assetList)) {
if ($SkipNoAssets) {
Write-Information 'Action skipped because no assets are found and [SkipNoAssetsFound = true] is configured'
- return
+ throw 'Action skip [SkipNoAssetsFound]'
}
else {
# no results found
@@ -658,6 +662,10 @@ function Get-TopdeskAssetsByPersonId {
$assetList = "- $defaultMessage
"
}
}
+ elseif ($SkipAssetsFound) {
+ Write-Information "Action skipped because assets are found and [SkipAssetsFound = true] is configured [$($assetList)]"
+ throw 'Action skip [SkipAssetsFound]'
+ }
write-output $assetList
}
#endregion
@@ -727,11 +735,6 @@ try {
# Use $($account.TopdeskAssets) in your notification configuration to resolve the queried assets
$account.TopdeskAssets = Get-TopdeskAssetsByPersonId @splatParamsTopdeskAssets
-
- # TopdeskAssets can only be empty if the action needs to be skipped [SkipNoAssetsFound = true]
- if ([string]::IsNullOrEmpty($account.TopdeskAssets)) {
- throw 'Action skip'
- }
}
# Resolve variables in the RequestShort field
@@ -1120,10 +1123,18 @@ catch {
# Only log when there are no lookup values, as these generate their own audit message
}
- 'Action skip' {
+ 'Action skip [SkipNoAssetsFound]' {
# If empty and [SkipNoAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
$outputContext.AuditLogs.Add([PSCustomObject]@{
- Message = 'Not creating Topdesk incident, because no assets are found and [SkipNoAssetsFound = true] is configured'
+ Message = 'Not creating Topdesk change, because no assets are found and [SkipNoAssetsFound = true] is configured'
+ IsError = $false
+ })
+ }
+
+ 'Action skip [SkipAssetsFound]' {
+ # If not empty and [SkipAssetsFound = true] in the JSON, nothing should be done. Mark them as a success
+ $outputContext.AuditLogs.Add([PSCustomObject]@{
+ Message = 'Not creating Topdesk change, because assets are found and [SkipAssetsFound = true] is configured'
IsError = $false
})
}