Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
234 changes: 113 additions & 121 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"value": "true",
"label": "Stop processing and generate an error"
},
{
{
"value": "false",
"label": "Clear the department field in Topdesk"
}
Expand Down
6 changes: 6 additions & 0 deletions permissions/change/example.change.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"Priority": "P1",
"EnableGetAssets": true,
"SkipNoAssetsFound": false,
"SkipAssetsFound": true,
"AssetsFilter": "Hardware,Software"
},
"Revoke": {
Expand All @@ -34,6 +35,7 @@
"Priority": "P1",
"EnableGetAssets": true,
"SkipNoAssetsFound": true,
"SkipAssetsFound": false,
"AssetsFilter": ""
}
},
Expand All @@ -56,6 +58,7 @@
"Priority": "P1",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {
Expand All @@ -72,6 +75,7 @@
"Priority": "P1",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
}
},
Expand All @@ -94,6 +98,7 @@
"Priority": null,
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {}
Expand All @@ -118,6 +123,7 @@
"Priority": null,
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
}
}
Expand Down
40 changes: 26 additions & 14 deletions permissions/change/grantPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {

[Parameter()]
[Boolean]
$SkipNoAssets
$SkipNoAssets,

[Parameter()]
[Boolean]
$SkipAssetsFound
)

if ($AssetFilter) {
Expand Down Expand Up @@ -640,14 +644,18 @@ 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
$defaultMessage = $actionContext.Configuration.messageNoAssetsFound
$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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -945,14 +949,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 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]@{
Expand Down Expand Up @@ -980,4 +992,4 @@ finally {
if ($outputContext.AuditLogs.IsError -notContains $true) {
$outputContext.Success = $true
}
}
}
41 changes: 26 additions & 15 deletions permissions/change/revokePermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -595,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {

[Parameter()]
[Boolean]
$SkipNoAssets
$SkipNoAssets,

[Parameter()]
[Boolean]
$SkipAssetsFound
)

if ($AssetFilter) {
Expand Down Expand Up @@ -641,14 +644,18 @@ 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
$defaultMessage = $actionContext.Configuration.messageNoAssetsFound
$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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -946,14 +949,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 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]@{
Expand Down Expand Up @@ -981,4 +992,4 @@ finally {
if ($outputContext.AuditLogs.IsError -notContains $true) {
$outputContext.Success = $true
}
}
}
6 changes: 6 additions & 0 deletions permissions/incident/example.incident.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ProcessingStatus": null,
"EnableGetAssets": true,
"SkipNoAssetsFound": false,
"SkipAssetsFound": true,
"AssetsFilter": "Hardware,Software"
},
"Revoke": {
Expand All @@ -46,6 +47,7 @@
"ProcessingStatus": null,
"EnableGetAssets": true,
"SkipNoAssetsFound": true,
"SkipAssetsFound": false,
"AssetsFilter": ""
}
},
Expand Down Expand Up @@ -74,6 +76,7 @@
"ProcessingStatus": null,
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {
Expand All @@ -96,6 +99,7 @@
"ProcessingStatus": "Geregistreerd",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
}
},
Expand Down Expand Up @@ -124,6 +128,7 @@
"ProcessingStatus": "Geregistreerd",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
},
"Revoke": {}
Expand Down Expand Up @@ -154,6 +159,7 @@
"ProcessingStatus": "Geregistreerd",
"EnableGetAssets": false,
"SkipNoAssetsFound": false,
"SkipAssetsFound": false,
"AssetsFilter": ""
}
}
Expand Down
29 changes: 20 additions & 9 deletions permissions/incident/grantPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,11 @@ function Get-TopdeskAssetsByPersonId {

[Parameter()]
[Boolean]
$SkipNoAssets
$SkipNoAssets,

[Parameter()]
[Boolean]
$SkipAssetsFound
)

# Check if the correlationAttribute is not empty
Expand Down Expand Up @@ -650,14 +654,18 @@ 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
$defaultMessage = $actionContext.Configuration.messageNoAssetsFound
$assetList = "- $defaultMessage<br>"
}
}
elseif ($SkipAssetsFound) {
Write-Information "Action skipped because assets are found and [SkipAssetsFound = true] is configured [$($assetList)]"
throw 'Action skip [SkipAssetsFound]'
}
write-output $assetList
}
#endregion
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]@{
Expand Down
Loading
Loading