Public/Get-ObservationsForPatient.ps1
<# .SYNOPSIS Query observations from salesforce for a specific patient. .DESCRIPTION Each object in the array contains the members - Id .INPUTS None. You cannot pipe objects to Get-ObservationsForPatient. .OUTPUTS An array of PSCustomObject .PARAMETER Patient A patient PSCustomObject from Get-Patients .EXAMPLE C:\PS> $observations = Get-ObservationsForPatient -Patient (Get-Patients -SelectCdrIds @("41dd4997-9d17-4527-8e86-6bdf4a102173")) .LINK Set-Config Get-Patients .NOTES Assumes config is initialized for org access. #> function Get-ObservationsForPatient { [CmdletBinding()] [OutputType([PSCustomObject[]])] param( [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline)] [ValidateNotNull()] [PSCustomObject] $Patient ) begin { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" } end { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete" } process { Write-Debug "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)" Invoke-SfQuery "SELECT Id FROM phecc__Observation__c WHERE phecc__Patient__c='$($Patient.sfPatient.Id)'" } } |