1. Go to setup.

  2. Search for visualforce pages.

  3. Click on new button.

  4. Enter suitable label and name eg. CampaignSendSMSPage.

  5. Provide description if required.

  6. Check “Available for Salesforce mobile apps and Lightning Pages” field as true.

  7. Clear input textarea and copy paste below given script.


<apex:page standardController="Campaign">
    <apex:includeScript value="{!URLFOR($Resource.smagicinteract__smJQuery, '/soap/ajax/14.0/apex.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.smagicinteract__smJQuery, '/soap/ajax/14.0/connection.js')}"/>
    <script>
    var packagePrefix = "smagicinteract__";
    var recordType = "campaignmember";
    var idToUpdate = "{!$CurrentPage.parameters.id}";//"{! Campaign.Id }";
    var leadPhoneField = "MobilePhone";
    var contactPhoneField = "MobilePhone";
    var optOutDefaultValue = 'no';
    var unrelatedObjectAPIName = ''; 
    
    if({!$Permission.smagicinteract__AllowToSendCampaignMessage}) { 
        var queryString = window.location.pathname;
        if (window.location.search){
            queryString = queryString + window.location.search
        }
        var url = "/apex/"+packagePrefix+"CampaignSMSSendPage?retURL="+queryString + "&objectType="+recordType+"&recordIds="+idToUpdate+"&optOutDefaultValue="+ optOutDefaultValue+"&leadPhoneField="+leadPhoneField+"&contactPhoneField="+contactPhoneField+"&unrelatedObjectName="+unrelatedObjectAPIName;
        if(typeof sforce !== 'undefined') {
            //sforce.one.back(true);
            sforce.one.navigateToURL(url, true);
        } else {
            window.location = url;
        }
    }
    else{
        alert('You cannot Run SMS Campaign. Please contact system admin'); 
    }
    </script>
</apex:page>



  1. Click on Save button.

  2. Again go to setup.

  3. Search for campaigns in quick find box.

  4. Click on Buttons, Links, and Actions.

  5. Click on New Button or Link.

  6. Give suitable label and name eg. SMS Campaign.

  7. Provide description if required.

  8. Select Display Type as Detail Page Button.

  9. Select Behaviour as Display in existing window without sidebar.

  10. Select Content Source as Visualforce Page.

  11. In Content select your visualforce page.

  12. Click on Save button.

  13. Go to detail page of any campaign record.

  14. Click on Edit Layout.

  15. Go to buttons.

  16. Drag and drop your created button.

  17. Switch to lightning experience.

  18. Now go to any campaign record.

  19. Send Campaign button is now available.