Public/Get-SfPatientPreferences.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<#
    .SYNOPSIS
    Queries salesforce for patient preferences.

    .DESCRIPTION
    Used to query for patient preferences for a single patient or all patients.

    .INPUTS
    None. You cannot pipe objects to Get-SfPatientPreferences.

    .OUTPUTS
    An array of PSCustomObject with the properties:
        Id
        Name
        phecc__Patient__c ( sfdc patient object id)

    .PARAMETER Patient
    The patient object from Get-Patients. If not supplied then all patient preferences are queries.

    .EXAMPLE
    PS> $ptPrefs = Get-SfPatientPreferences

    .LINK
    Set-FileConfig
    Get-Patients

    .NOTES
    Assumes config is initialized for org access.
#>

function Get-SfPatientPreferences {
    param($Patient)
    if ($Patient) {
        Invoke-SfQuery "SELECT Id,Name,phecc__Patient__c FROM phecc__Patient_Preference__c WHERE phecc__Patient__c='$($Patient.sfPatient.Id)'"
    } else {
        Invoke-SfQuery "SELECT Id,Name,phecc__Patient__c FROM phecc__Patient_Preference__c"
    }
}