The SMS on Job Complete function is responsible for sending an SMS notification to a customer when a job (visit) is marked as complete on teh mobile app.
Here’s how it operates:
1. Template Selection:
The function first determines which SMS template to use by looking up the job type for the visit. If no template is set, the function exits without sending an SMS.
2. Contact Selection:
It checks a system setting to decide which contact should receive the SMS. This can be the main contact, billing contact, or site contact associated with the job.
3. Mobile Number Retrieval:
The function retrieves the mobile number for the selected contact. If no valid mobile number is found, the SMS is not sent.
4. Message Generation:
Using the chosen template and visit ID, the function generates the SMS message body.
5. Sending the SMS:
The SMS is sent from a configured sender name to the customer’s mobile number. If the SMS is successfully sent, a log entry is created for tracking.
Summary:
This function automates customer communication by sending a job completion SMS to the appropriate contact, using system settings to control the template and recipient. If any required information (template or mobile number) is missing, the function safely exits without sending a message.
Updated: 31 July 2025