Show Outgoing SMS in Activity History

July 03, 2014

Trigger to show outgoing SMS in activity history

(creating task on Outbound SMS)

*smagicinteract is the package prefix. You can select the package prefix according to your SMS Magic package:

Package Version Package Prefix
SMS Magic Interact 1.23 smsmagicvc1
SMS Magic Interact 1.36 smagicinteract


trigger CreateSMSActivityTrigger on smagicinteract__smsMagic__c (before insert) {
Date todaysDate =;
List taskList = new List();
for(smagicinteract__smsMagic__c sms :{
Task newTask = new Task();
newTask.OwnerId = Userinfo.getUserId();
newTask.Status = ‘Completed’;
newTask.Subject = ‘SMS to number ‘+sms.smagicbasic__PhoneNumber__c;
newTask.Priority = ‘Medium’;
newTask.Type = ‘Text Message’;
newTask.ActivityDate = todaysDate;
newTask.WhoId = sms.smagicbasic__Lead__c;//attach task record in activity related list of Lead
newTask.Description = sms.smagicbasic__SMSText__c;
system.debug(system.logginglevel.INFO, ‘taskList :’+taskList);
insert taskList;
}catch(Exception e){
system.debug(system.logginglevel.INFO,’exception :’+e);

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>