How to Add Formula Field”) Lead/Contact objects comes preconfigured with sms-magic for sending sms, you might just need to add buttons using page/search layout of respective objects.
How to configure SMS Sending
A. Create ‘Send SMS’ & ‘Send Bulk SMS’ Buttons (For Leads & Contacts these buttons are already available in the package) B. Configure above SMS buttons on ‘Page Layout’ & ‘Search Layout’ of the Concerned Object
A. Creating Buttons (Skip this step for Leads and contacts. Just start with Configuring)
Send SMS
(i) Goto Setup–> Customize –> (object name)–> buttons & links
(ii) Click on New Under the lable “Custom Buttons and Links”.
(iii) Now fill required data Such as label, Name etc
- Select the Display type as “Detail PageButton”.
- Behaviour as “Execute JavaScript”.
- Select the content Source as “onClick JavaScript”.
Now paste the following JavaScript into the given text field and save it.
- Change “packagePrefix” to “smagicbasic__” if using it for SMS Magic basic package.
- Please make sure the object name is correct.
- Include the field where mobile number is picked.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
var packagePrefix = "smagicinteract__";
var recordType = 'contact';
var idToUpdate = '{!Contact.Id}'
var nameField = 'Name';
var mobileField = 'MobilePhone';
var queryString = parent.window.location.pathname;
if (parent.window.location.search){
queryString = queryString + parent.window.location.search
}
var url = "/apex/"+packagePrefix+"BulkSendSMS?retURL="+queryString+"&nameField=" +nameField +"&phoneField="+ mobileField + "&objectType="+recordType+"&recordIds="+ idToUpdate;
parent.window.location = url;
/*
* Here you can add some more parameters as given below
* 1. You can specify the optOutField in parameter. The field which you are using for outouting record form sending sms.
* var optOutField = <optout Field api name>
* 2. Now you need to add this field into the variable url.
* For example,
*
* var optOutField = 'smagicinteract__SMSOptOut__c';
* var url = "/apex/"+packagePrefix+"BulkSendSMS?retURL="+queryString+"&nameField=" +nameField +"&phoneField="+ mobileField + "&objectType="+recordType+"&recordIds="+ idToUpdate+"&optOutField="+ optOutField;
*
*/ |
Send Bulk SMS
For creating Send Bulk SMS, follow the same steps as in “send SMS” .
Only the button configurations will be different. Change the display type as “List Button” & use the below code:
Code for Send Bulk SMS:
Please check the object name & mobile number field.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
var packagePrefix ="smagicinteract__";
var records = {!GETRECORDIDS($ObjectType.Lead)};
if (records[0] == null){
alert("Please select at least one Record")
}
else{
var recordType = "Lead";
var recordIds = "";
var nameField = 'Name';
var mobileField = 'MobilePhone';
for (var n in records) {
if(n == 'remove' || n == 'indexOf') continue;
recordIds = recordIds + records[n];
if (n != records.length-1) {
recordIds = recordIds + ",";
}
}
var queryString = parent.window.location.pathname;
if (parent.window.location.search){
queryString = queryString + parent.window.location.search
}
var url = "/apex/"+packagePrefix+"BulkSendSMS?retURL="+queryString + "&nameField=" +nameField +"&PhoneField="+ mobileField+ "&objectType="+recordType+"&recordIds="+ recordIds;
parent.window.location = url;
}
/*
* Here also you can add parameters like optOutField as shown in previous code.
*/ |
B. Configuring Buttons (on Page Layout & Search Page Layout)
Send SMS
Send SMS button has to added to the page layout. You can follow the below steps:
(Below example is for Contacts Object)
Step 1: Goto Setup –> Customize–> Contacts–> Page Layout –> Edit
Step 2: Drag and drop the Send SMS button to the page layout.
The Send SMS Button will now appear in the page layout of Contact.
Send Bulk SMS
Send Bulk SMS button has to be added to the search layout.
Step 2: Add it to the search layout and click save.
Send Bulk SMS will now appear within the search layout of Contacts.
If you find this useful, say thanks by sharing it..






