Skip to main content

We use SMS Magic (Screen Magic) to send text messages in our Org. I’m attempting to add the on-click javascript to the button, but am running into an issue. I’ve followed the steps in this thread:

https://community.skuid.com/t/list-view-button-added-to-skuid-table

which is for the same app. However, the code in this version of the managed application is different. It requires this code:

{!REQUIRESCRIPT(“/soap/ajax/14.0/connection.js”)} 
{!REQUIRESCRIPT(“/soap/ajax/14.0/apex.js”)} 
{!REQUIRESCRIPT(‘/resource/smagicinteract__smJQuery/js/jquery-1.10.2.js’)} 
{!REQUIRESCRIPT(‘/resource/smagicinteract__smJQuery/js/jquery-ui-1.10.4.custom.min.js’)} 
{!REQUIRESCRIPT(“/resource/smagicinteract__sendSMSJS”)} 

var packagePrefix = “smagicinteract__”; 
var recordType = ‘PRC_Client__c’; 
var idToUpdate = ‘{!PRC_Client__c.Id}’ 
var nameField = ‘Name’; 
var mobileField = ‘Phone_Number__c’; 
var optOutField = ‘smagicinteract__SMSOptOut__c’; 
var optOutDefaultValue = ‘yes’; 
var smsType = ‘’; 
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);

Which does nothing but load a blank white page with the SF sidebar/header as long as the line:

var cssUrl = ‘{!URLFOR(’/resource/smagicinteract__smJQuery/css/sm-theme/jquery-ui-1.10.4.custom.min.css’)}';

Is included. Is there a way around this app causing an error by including this script?

Thanks,
Brad Smith

Along the lines of the steps in the community post you linked to, you need to do the following:

1. Add a JavaScript Resource of Resource Type “External” to your Skuid Page for each of the following URL’s:

/soap/ajax/14.0/apex.js
/resource/smagicinteract__sendSMSJS

2. Add a JavaScript Resource of Resource Type “Inline (Snippet)” to your Skuid Page called “sendSMS” with the following code:

var params = argumentsm0];
var row = params.item ? params.item.row : params.row;

var packagePrefix = “smagicinteract__”; 
var recordType = ‘PRC_Client__c’; 
var idToUpdate = row.Id;
var nameField = ‘Name’; 
var mobileField = ‘Phone_Number__c’; 
var optOutField = ‘smagicinteract__SMSOptOut__c’; 
var optOutDefaultValue = ‘yes’; 
var smsType = ‘’; 
var userId = skuid.utils.userInfo.userId; 
var elementIdVar = ‘’; 
var showUserDropDown = false; 
var dialogTitle = ‘’; 
var cssUrl = ‘/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);

3. Add a Page Title Button to your Page Title, or Row Action to your Table (depending on what you’re trying to do) that runs a Snippet, with Snippet Name set to “sendSMS”.



Thanks, that did it. Much appreciated!