For all examples provided below, ScriptUtil.getKeyword("@ptVisitType")
sources the information set under the appointment "Type" dropdown and ScriptUtil.getKeyword("@ptApptReason")
sources the information set under the appointment "Reason" dropdown in the booking dialogue window.
The @ptApptReason
keyword cannot read any content written into the "Reason" text area.

Replace instances of "apptType" and "apptReason" with the corresponding type and reason values from your EMR.
Appointment type and reason are:
If you need to match against an appointment with a specific type and reason.
pt.getReasonForVisit() != null && (ScriptUtil.getKeyword("@ptVisitType") == "apptType" && ScriptUtil.getKeyword("@ptApptReason") == "apptReason")
Copy Rule
Example: If you wish to match on an appointment with type "COPD" and reason "Follow Up", your completed script would be as follows: pt.getReasonForVisit() != null && (ScriptUtil.getKeyword("@ptVisitType") == "COPD" && ScriptUtil.getKeyword("@ptApptReason") == "Follow Up")
Appointment type and reason are not:
If you need to exclude an appointment with a specific type and reason, but match on all other types and reasons.
pt.getReasonForVisit() != null && ScriptUtil.getKeyword("@ptVisitType") != "apptType" && ScriptUtil.getKeyword("@ptApptReason") != "apptReason"
Copy Rule
Appointment type and reason are one of:
Match on one or more pairs of appointment types and reasons.
pt.getReasonForVisit() != null && ((ScriptUtil.getKeyword("@ptVisitType") == "apptType" && ScriptUtil.getKeyword("@ptApptReason") == "apptReason") || (ScriptUtil.getKeyword("@ptVisitType") == "apptType2" && ScriptUtil.getKeyword("@ptApptReason") == "apptReason2"))
Copy Rule
Note: It is possible to match more than two different pairs of appointment types and reasons. You can modify the rule to include additional (ScriptUtil.getKeyword("@ptVisitType") == "apptType" && ScriptUtil.getKeyword("@ptApptReason") == "apptReason")
functions separated by ||
("or") operators.
Appointment type and reason are not one of:
Exclude one or more pairs of appointment types and reasons, but match on all other types and reasons.
pt.getReasonForVisit() != null && ScriptUtil.getKeyword("@ptVisitType") != "apptType" && ScriptUtil.getKeyword("@ptApptReason") != "apptReason" && ScriptUtil.getKeyword("@ptVisitType") != "apptType2" && ScriptUtil.getKeyword("@ptApptReason") != "apptReason2"
Copy Rule
Note: It is possible to exclude more than two different pairs of appointment types and reasons. You can modify the rule to include additional ScriptUtil.getKeyword("@ptVisitType") != "apptType" && ScriptUtil.getKeyword("@ptApptReason") != "apptReason"
functions separated by &&
("and") operators.
Appointment type and/or reason contains:
Match appointment type(s) and/or reason(s) by a partial or common value.
pt.getReasonForVisit() != null && (ScriptUtil.getKeyword("@ptVisitType").includes("apptType") && ScriptUtil.getKeyword("@ptApptReason").includes("apptReason"))
Copy Rule
Example: If you have a series of appointments containing common terms — Type: Virtual, Reason: Follow Up; Type: Virtual, Reason: COPD; Type: Virtual, Reason: Prescription — you can match against the common term "Virtual" to target all appointment types and reasons.
Please note: The includes()
function matches against all instances of the supplied value, meaning something like "Virtually" would also be considered a match, as it contains the term "Virtual."
Appointment type and/or reason does not contain:
Exclude appointment type(s) and reason(s) by a partial or common value.
pt.getReasonForVisit() != null && !ScriptUtil.getKeyword("@ptVisitType").includes("apptType") && !ScriptUtil.getKeyword("@ptApptReason").includes("apptReason")
Copy Rule