Open easitanth opened 3 months ago
We should provide a easy way to return a "result object" back to Easit GO when a scripts completes.
A suggestion is to create a PSCustomObject in 'Set-EPREnvironment' and add it as a global variable, for example 'eprResult'.
$eprResult = [PSCustomObject]@{ eprErrorMessage = $null eprReturnMessage = $null eprReturnCode = 0 } New-Variable -Name "eprResult" -Scope 'Global' -Value
Usage:
begin { Set-EPREnvironment } process { try { $fileContent = Get-Content -Path "$PSScriptRoot\myfile.txt" -Raw } catch { $eprResult.eprReturnMessage = "Unable to get content from file" $eprResult.eprErrorMessage = $_.Exception $eprResult.eprReturnCode= 1 } } end { Send-ToEasitGO -Url 'urltoEasitGO' -Apikey 'myApikey' -ImportHandlerIdentifier 'resultFromEPR' -Item $eprResult }
We should provide a easy way to return a "result object" back to Easit GO when a scripts completes.
A suggestion is to create a PSCustomObject in 'Set-EPREnvironment' and add it as a global variable, for example 'eprResult'.
Usage: