Skip to content

Instantly share code, notes, and snippets.

@kbs5280
Created August 27, 2019 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbs5280/ba2b96dc0770a7597a955c8fd56f587e to your computer and use it in GitHub Desktop.
Save kbs5280/ba2b96dc0770a7597a955c8fd56f587e to your computer and use it in GitHub Desktop.
Customer Dynamics - Selective Consult Inventory Query
// Replace
SELECT id, Apt_Date__c,Arrival_Time__c, Consult_Room__c FROM Consult_Inventory__c WHERE Patient_Phone__c = '{global:SearchANI}' LIMIT 1
// With
SELECT Id, Apt_Date__c, Arrival_Time__c, Consult_Room__c FROM Consult_Inventory__c
WHERE Consult_Room__r.Room_Type__c NOT IN ('Practice','Unconfirmed')
AND (Apt_Date__c >= LAST_N_DAYS:30 AND Apt_Date__c <= TODAY)
AND Special_Initiative__c NOT IN ('Workshop','Group Consult')
AND Pre_Screen_Type__c != 'Seminar'
AND isConsultScheudled__c = 1
AND Active__c = true
AND IsOnHold__c = false
AND Patient_Phone__c = '{global:SearchANI}'
LIMIT 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment