Public/Get-SfPatients.ps1
<# .SYNOPSIS Queries salesforce for patients .DESCRIPTION Used to query for patients in the salesforce org by status .INPUTS None. You cannot pipe objects to Get-SfPatients. .OUTPUTS An array of PSCustomObject with the properties: Id phecc__CDRPID__c phecc__Delivery_Channel__c phecc__Permission__c phecc__Status__c phecc__Tier_of_Service__c .PARAMETER Status The status to query patients. If not supplid then the default is "Active". Use $null for all patients. .EXAMPLE PS> $allPatients = Get-Patients -Status $null PS> $activePatients = Get-Patients PS> $pending = Get-Patients -Status "Pending - Activation" .LINK Set-FileConfig .NOTES Assumes config is initialized for org access. #> function Get-SfPatients { param($Status, $Id) if ($PSBoundParameters.ContainsKey('Status')) { $query = "SELECT Id,phecc__CDRPID__c,phecc__Permission__c,phecc__Status__c,phecc__Tier_of_Service__c,phecc__Delivery_Channel__c FROM phecc__Patient__c WHERE IsDeleted=False AND phecc__Status__c='$($Status)'" } else { $query = "SELECT Id,phecc__CDRPID__c,phecc__Permission__c,phecc__Status__c,phecc__Tier_of_Service__c,phecc__Delivery_Channel__c FROM phecc__Patient__c WHERE IsDeleted=False" } if ($PSBoundParameters.ContainsKey('Id')) { $query += " AND Id='$($Id)'" } Invoke-SfQuery $query } |