Public/Get-FlagsForPatient.ps1

<#
    .SYNOPSIS
    Query flags from salesforce for a specific patient.
 
    .DESCRIPTION
    Each object in the array contains the members
        - Id
        - phecc__Description__c
        - phecc__Intervention_Rule__c
        - phecc__Patient__c
 
    .INPUTS
    None. You cannot pipe objects to Get-FlagsForPatient.
 
    .OUTPUTS
    An array of PSObject
 
    .PARAMETER Patient
    A patient PSObject from Get-Patients
 
    .EXAMPLE
    C:\PS> $result = Get-FlagsForPatient -Patient (Get-Patients -SelectCdrIds @("41dd4997-9d17-4527-8e86-6bdf4a102173"))
 
    .LINK
    See Get-Patients
 
    .NOTES
    Assumes config is initialized for org access.
#>

function Get-FlagsForPatient {
    param([PSObject]$Patient)
    Invoke-SfQuery "SELECT+Id,phecc__Description__c,phecc__Intervention_Rule__c,phecc__Patient__c+FROM+phecc__Flag__c+WHERE+phecc__Patient__c='$($Patient.sfPatient.Id)'"
}