Functions/Get-IAWidgetDataValueFieldMaps.ps1

Function Get-IAWidgetDataValueFieldMaps {
    <#
        .SYNOPSIS
            Returns Data Value Field Maps.
        .DESCRIPTION
            This function can be used to get Data Value Field Maps for a certain Widget Template. 'Data Value Field Maps' are the different data fields that you see in a widget ('Compliant','Noncompliant' etc...).
        .OUTPUTS
            A Widget Template with a list of Data Value Field Maps expanded.
        .EXAMPLE
            $DataValueFieldMaps = Get-IAWidgetDataValueFieldMaps -WidgetTemplateId '3f6f5a65-402d-40b4-2144-08d76e928790'
            $DataValueFieldMaps.WidgetDataValueFieldMaps
             
    #>

    Param(
        [Parameter(Mandatory=$true)]
        [String] $WidgetTemplateId
    )


    $Uri = "WidgetTemplates($WidgetTemplateId)" + '?$expand=WidgetDataValueFieldMaps'

    $response = Invoke-IAQuery -QueryUrl $Uri -Method Get

    if ($null -eq $response.WidgetDataValueFieldMaps) {
        return $null
    }

    return $response
}