Public/Update-TMTaskProgress.ps1

Function Update-TMTaskProgress {
    param(
        [Parameter(Mandatory = $true)]
        [ValidateRange(0, 100)]
        [int]$Progress,

        ## Extra Features / Data Values
        [Parameter(Mandatory = $false)][String]$Message
    )
    ## Allows running scripts that call these functions, so long as there is no Action Request
    # if (-Not $global:actionRequest) { return }

    ## If the Script wants to provide a 'Message', Messages are logged as task notes.
    if ($Message) {
        $MessageOption = @{ Message = $Message }
    }

    ## Post Back Success with Data and Messages as provided by the Script
    Set-TMTaskAction -TMDCallbackOptions $global:TMDCallbackOptions -State 'progress' -Progress $Progress @MessageOption
}