Functions/Set-IAWidgetDataValueFieldMap.ps1

Function Set-IAWidgetDataValueFieldMap {
    <#
        .SYNOPSIS
            This is used to change a Widget Data Value Field Map.
        .DESCRIPTION
            This function is used to change the properties of a Widget Data Value Field Map.
        .EXAMPLE
            $IAWidget = Get-IAWidget -Id '1922ef57-bd02-4433-ca16-08d7726d4ac0' -Expand
 
            $WDVFP = $IAWidget.WidgetDataValueFieldMaps | Where-Object -Property DataValueFieldName -eq 'InProgressClientCount'
            $WDVFP.Display = $false
 
            Set-IAWidgetDataValueFieldMap -IAWidgetDataValueFieldMap $WDVFP
    #>

    Param(
        [Parameter(Mandatory = $true)]
        [PSObject] $IAWidgetDataValueFieldMap
    )
    $Uri = "WidgetDataValueFieldMaps($($IAWidgetDataValueFieldMap.Id))"
    
    $Body = $IAWidgetDataValueFieldMap | ConvertTo-Json

    Write-Verbose "Body: $Body"

    $response = Invoke-IAQuery -QueryUrl $Uri -Method Patch -Body $Body
    if ($null -eq $response.value) {
        return $null
    }

    return $response.value
}