lwhitelock / NinjaOneAutomation

A collection of useful scripts for NinjaOne

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate-Device-Alert-Heatmap - errors with Value cannot be null & FIELD_NOT_FOUND

cyanide699 opened this issue · comments

using the https://github.com/lwhitelock/NinjaOneAutomation/blob/main/DocumentationScripts/Generate-Device-Alert-Heatmap.ps1

i have setup a WYSIWYG global device field named alertHeatMap with API read/write permissions

I can see this custom field from the API..

however running the script just results in thousands of lines of:

Line |
8 | $Index = [array]::indexof($MapList, "$count")
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "IndexOf" with "2" argument(s): "Value cannot be null. (Parameter 'array')"
Invoke-WebRequest:
Line |
21 | … $Result = Invoke-WebRequest -uri "$($NinjaURL)/api/v2/device/$($Dev …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"resultCode":"FIELD_NOT_FOUND","errorMessage":"Field Not Found","incidentId":"WEB_MGMT_SERVICE-1a-1696518033-EVOGGJQM"}
heatmap1
heatmap2