An SMS can be sent out automatically using a workflow e.g., in the process builder.
To do that, you need to specify parameters like a subject line or SMS text.
Required parameters to invoke Apex
•Mobile Phone number
•Contact or lead or account relationship, e.g. direct ID
•Subject line (option)
•SMS text (mandatory)
•Call result (option) - either complete name or API name
•Call result group (option) - either complete name or API name
If no mobile phone number is specified, a contact or lead or account relationship is required. If both are specified, the mobile number has priority.
A task is created depending on the configuration settings and considering the record type. If the subject line is empty, the SMS subject line from the configuration is used.
Go to Salesforce Setup-> (Quick search)-Process Builder ->Click on “New“ to create new process.
Click to add an object for that process is created. Example: Case. Also select when record is created as we want to send the SMS when case is created.
Define case criteria.
Add action for that criteria, select Apex and the apex class Mirage__MirageSMSUsingProcess that we are calling.
Now set values for the Apex method variables.
Parameters used to pass values from process are -
•recordId
•
Ex- ContactID(The SMS will go to that object's mobile number, Ex- contact mobile number )
Ex- AccountId(The SMS will go to that object's Phone number, Ex- Account phone number)
Ex- LeadID(The SMS will go to that object's mobile number, Ex- Lead mobile number )
•defaultDestinationNumber
Mobile number to which SMS will be sent
•textMessage
Body of the message to send SMS
•subjectLine
Subject to create activity
•wrapUp
To fill call result to activity
•createActivityForSMS
When true, activity is created
SMS Configuration Cases
Case 1 - Default destination number is specified.
SMS will be sent to the default destination number specified in the configuration
Case 2 - Record id is specified
SMS will be sent to the record (Contact/Account/Lead) mobile/phone number specified in the configuration.
Ex- ContactId (The SMS will go to that object's mobile number, Ex- contact mobile number )
Ex- AccountId (The SMS will go to that object's Phone number, Ex- Account phone number)
Ex- LeadId (The SMS will go to that object's mobile number, Ex- Lead mobile number )
Case 3 - Default destination number and record id both are specified
SMS will be sent to the default destination number specified in the configuration. Priority is always given to the default destination number over the record id.