Create/Edit/View
This is the create/edit/view screen for SMS appointment reminder templates.
These are used to generate SMS text for appointment reminders based on an expression. The template can be plain text, macros, or an XPath expression.
The screen is in two parts - the top contains the fields, the bottom allows the template to be tested.
The fields are as follows:
Name | the name of the template |
Description | a description of the template. This should be used if necessary to clarify the purpose of the template. |
Active | uncheck this to deactivate the template. |
Content Type |
the template content type. One of Plain Text, Macro or Expression |
Content |
The content used to generate the SMS text. This should produce text no longer than 160 characters. XPath expressions may use the following variables directly:
These variables are also available to XPath expressions used by macros, if the Content Type is Macro. The expression itself can be up to 5000 characters long so can be quite complex |
The bottom part of the screen contains:
Customer | allows a customer to be selected, to test the template |
Patient | allows a customer to be selected, to test the template |
Message | the generated message. The count shows the number of characters remaining. |
Status | this displays any error message, if the template fails to generate the SMS text |
Example XPath expression
concat("Reminder: ",
expr:if(expr:var("patient.name") != "", concat(expr:var("patient.name"), " has"), "you have"),
" an appointment at " , $location.name," on ", date:formatDate($appointment.startTime, "short"),
" @ ", date:formatTime($appointment.startTime, "short"), $nl,
'Call us on ', party:getTelephone($location), ' for any queries')
The XPath expression above will generate an SMS message like:
Reminder: Muffett has an appointment at Main Clinic on 28/11/15 @ 9:00 AM
Call us on 041312345 for any queries
If the appointment has no patient, it will generate an SMS like:
Reminder: you have an appointment at Main Clinic on 28/11/15 @ 9:00 AM
Call us on 041312345 for any queries
Example XPath expression for Surgery
It is quite possible to generate difference messages depending on the type of appointment. This example generates a different message if the appointment type is 'Admit - Surgery'
expr:if($appointment.appointmentType.entity.name = 'Admit - Surgery',
concat("Reminder: East Island Vets Surgery Appointment", $nl,
expr:var("patient.name")," ",
date:formatDate($appointment.startTime, "short"),
" @ ", date:formatTime($appointment.startTime, "short"), $nl,
"Remember: water is OK but no food after 9pm ",date:formatDate(date:add($appointment.startTime,"-1d"), "short"),$nl,
'If queries phone ', party:getTelephone($location)),
concat("Reminder: East Island Vets Appointment", $nl,
expr:if(expr:var("patient.name") != "",expr:var("patient.name"), "is on")," ",
date:formatDate($appointment.startTime, "short"),
" @ ", date:formatTime($appointment.startTime, "short"), $nl,
'If queries phone ', party:getTelephone($location))
)
For a surgery appointment with a patient 'Mr Moo' this will generate an SMS message like:
Reminder: East Island Vets Surgery Appointment
Mr Moo 15/12/15 @ 10:00 AM
Remember: water is OK but no food after 9pm 14/12/15
If queries phone 2915 3999
Date Switching
If you want to replace the date by 'today' or 'tomorrow' when appropriate, you can use the following as a replacement for the date:formatDate() call in the above:
expr:if((date:formatDate($appointment.startTime) = date:formatDate(java.util.Date.new())),"today",
expr:if((date:formatDate($appointment.startTime) = date:formatDate(date:add(java.util.Date.new(),"1d"))),"tomorrow",
date:format($appointment.startTime, "dd MMM")))