Public/Set-PatientStatus.ps1
function Set-PatientStatus { param( [Parameter(Mandatory, Position = 0, ValueFromPipeline)] [ValidateNotNullOrEmpty()] [PSObject]$Patient, [Parameter(Mandatory, Position = 1)] [ValidateSet("Pending - Activation", "Active", "Suspended", "Pending - Removal", "Removed")] [String]$Status ) process { $body = [PSCustomObject]@{ phecc__Status__c = $Status } $json = ConvertTo-Json $body -Depth 100 Invoke-SfApi -Path "/sobjects/phecc__Patient__c/$($Patient.sfPatient.Id)" -Method Patch -Body $json } } |