How to send SMSs to objects with a temporary association in Salesforce

July 27, 2016
Nupur Maskara

Just like two persons can be in a relationship, similarly on Salesforce, two objects can be related. This means that they have a lookup field to establish a relationship. Now consider two objects on Salesforce which are not related. Sometimes you may want to send texts which use merge fields of unrelated objects. This is useful in the case of objects which have a temporary association. It will save you the trouble of creating related objects that you will not use later and that will clutter up your Salesforce.

For instance, let’s look at Dan, who has a car dealership, Cartwheels. Dan might want to run a limited period promotion on a new car. So here, Dan’s new promotional message would be the temporary object. Dan can put it in a template and text his target segment of customers.

Or, let’s say you have a recruitment agency. You can now send details of a job to candidates in your database without creating a lookup to a job for each candidate.

Here’s how to configure this feature-

Make sure that you have the latest version of SMS-Magic Interact installed. Go to ‘Setup.’ Click on ‘Customize.’ Choose your object. For instance, if it is the Contacts object, Click on ‘Contacts.’ Click on ‘Buttons, Links and Actions.’

Salesforce Objects Temporary Association SMS 1

Go to ‘Send SMS.’

Send SMS

Copy the OnClick JavaScript.

OnClick Java Script

Now, go back and click on ‘New Button or Link.’

New button or link

Give a Label Name so that it is easy for you to find it. In Display Type, Select ‘Detail Page Button.’ In Behavior, Select ‘Execute JavaScript’ from the dropdown.

Paste the OnClick JavaScript that you had copied earlier, in the text box below Select Field Type.

Create Button

Copy API Name and paste it in the inverted commas next to var unrelated ObjectAPIName = Save/Quick Save it.

Copy API Name

Go to ‘Edit Layout.’ Go to ‘Buttons’, then ‘Promotional SMS.’ Drag it to the Custom Buttons section to create your new button.

Create New Button

From ‘SMS Settings,’ Configure a Template Type with original object and unrelated object fields.

Configure template

Create a template.

Create Template

Click on your new ‘Promotional Text’ Button and you will see this-

Unrelated object

Enter a search keyword based on the text you’ve written and saved as a template. Click on the search icon.

Select the result you want and choose your template. Click on ‘Send.’

Search Unrelated Object SMS

That’s it! Please contact us on [email protected] if you need any help in installing or using this feature. Do let us know your use cases for texting unrelated objects in Salesforce in the comments section below.

 

3 Comments. Leave new

Hey, is this functionality available through apex?

Cheers

Reply

Cool, after looking at what’s global in the Template Resolver class source, it appears that there are additional accepted arguments.

e.g.
global Map resolveTemplate(String originalTemplate, Schema.SObjectType objectType, List recordIds, Set extraFields, Map unrelatedObjectIdMap, smagicinteract.MessageType messageCategory);

It’d be great to see this stuff added to the Resolve Templates page of your documentation here.

Cheers

Reply
Nupur Maskara
July 19, 2017 3:18 pm

Thanks for pointing this out, Nic! Yes, the method is possible but we missued updating our documentation. We’ll do that now.

Reply

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>