Send SMS from Pop-up

May 19, 2014
Send SMS button requires a mobile number field to send SMS. The field in which mobile number is present can be used in the button code.

Send SMS buttons are pre-configured for Leads & Contacts, you just have to add them to the page layouts (these buttons use the standard mobile phone field to send SMS. In case you need to use any other field for sending SMS, you can create new buttons as described below).


Step 1: Create Send SMS button (Skip this step for Leads and Contacts)

In the example below, we will configure a “Send SMS” button on the Accounts object.

1. Go to Setup–> Customize –> Accounts(object name)–> Buttons & Links.

2. Click on New Under the label “Custom Buttons and Links”.

custom-button-creation (2)
3. Fill required data Such as label, Name etc.

  • Select the Display type as “Detail Page Button”.
  •  Behaviour as “Execute JavaScript”.
  • Select the content Source as “OnClick JavaScript”.
send sms - custom obj
Code for Send SMS button (through Pop up):

var packagePrefix = 'smagicinteract__';
var recordType = 'Account';
var idToUpdate = '{!Account.Id}';
var nameField = 'Name';
var mobileField = 'MobilePhone';
var optOutField = 'smagicinteract__SMSOptOut__c';
var optOutDefaultValue = 'yes';
var smsType = 'popup'; // for pop up, use value -'popup'
var userId = '{!$User.Id}';
var elementIdVar = '';
var showUserDropDown = false;
var dialogTitle = '';
var cssUrl = '{!URLFOR('/resource/smagicinteract__smJQuery/css/sm-theme/jquery-ui-1.10.4.custom.min.css')}';

sendSMS(recordType, idToUpdate, userId, nameField, mobileField, optOutField, optOutDefaultValue, smsType, elementIdVar, packagePrefix, showUserDropDown, dialogTitle, cssUrl);


Details of parameters which can be modified :
recordType - include the object API name.
idToUpdate - include the object ID of the object used.
mobileField - use the field name which contain mobile phone of the record.
optOutField - use the field which contains opt out preference of the record.
smsType - this parameter can be used to sepcify the type of interface required. For Visualforce page, it should be left blank. For popup, its value should be 'popup'.
dialogTitle - you can mention the name of pop up dialogue box in this parameter.
optOutDefaultValue = use this field to set the default value of opt out.
You can change the parameter ‘smsType’ to toggle between Visualforce page or popup interface. If you wish to use a VF page, use a blank value for this parameter.


Step 2: Adding buttons to page layouts

The Send SMS button created in Step 1 has to be added to the page layout of the objects.

1. Go to Setup –> Customize–> Accounts–> Page Layout –> Edit –> Buttons.

2. Drag and drop the Send SMS button to the custom buttons area and click save.

add-send-SMS-to-page-layout1 (2)
The “Send SMS” button is ready to be used on Account records!

If you face any issue with IE8  Click here

Related Posts

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>