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 )
Ex- AccountId(The SMS will go to that object's Phone number, Ex- Account)
Ex- LeadID(The SMS will go to that object's mobile number, Ex- Lead )
•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