This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger CreateFollowupTask on Lead (after insert, after update) { | |
List <Task> followupTasks = new List <Task> (); | |
for (Lead newLead : trigger.new) | |
{ | |
if (newLead.isConverted) continue; | |
if (newLead.Status == 'Open - Not Contacted') { | |
Task newTask = new Task ( Subject = 'Intial call', Type = 'Call', ActivityDate = Date.Today().AddDays(2), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public class TestCreateInitialCallTaskTrigger | |
{ | |
@isTest | |
public static void TestInitialCallTaskIsCreated () | |
{ | |
Lead l = new Lead (LastName = 'Test', Company = 'Acme'); | |
insert l; | |
List<Task> createdTasks = [SELECT Subject, WhoId, ActivityDate FROM Task]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public class TestCreateInitialCallTaskTrigger | |
{ | |
@isTest | |
public static void TestInitialCallTaskIsCreated () | |
{ | |
Lead l = new Lead (LastName = 'Test', Company = 'Acme'); | |
insert l; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger CreateInitialCallTask on Lead (after insert) { | |
List <Task> initialCallTasks = new List <Task> (); | |
for (Lead newLead : trigger.new) | |
{ | |
Task newTask = new Task ( Subject = 'Intial call', Type = 'Call', ActivityDate = Date.Today().AddDays(2), | |
Status = 'Not Started', whoId = newLead.Id); | |
initialCallTasks.Add (newTask); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Feature13Installer extends InstallHandlerBase { | |
public override Version GetLastPackageVersionWithoutFeature () { | |
return new Version (1,2); | |
} | |
public override void OnFreshInstall (InstallContext context) { | |
InitializeFeature13(); | |
} | |
public override void OnUpgradeFromOldPackage (InstallContext context) { | |
UpgradeForFeature13(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Feature12Installer extends InstallHandlerBase { | |
public override Version GetLastPackageVersionWithoutFeature () { | |
return new Version (1,1); | |
} | |
// Migrate data for older versions | |
public override void OnUpgradeFromOldPackage (InstallContext context) { | |
UpgradeForFeature12(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Feature10Installer extends InstallHandlerBase { | |
public override Version GetLastPackageVersionWithoutFeature () { | |
return new Version (0,0); | |
} | |
// Only initialize package on a fresh install! | |
public override void OnFreshInstall (InstallContext context) { | |
InitializePackage(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class InstallHandlerBase implements InstallHandler | |
{ | |
public abstract Version GetLastPackageVersionWithoutFeature (); | |
public void onInstall(InstallContext context) | |
{ | |
if (isFreshInstall (context)) | |
{ | |
OnFreshInstall (context); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Feature13Installer implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
if (context.previousVersion() == null) | |
{ | |
InitializePackage(); | |
} | |
else if (context.previousVersion().CompareTo(new Version (1,3)) < 0) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Feature12Installer implements InstallHandler { | |
global void onInstall (InstallContext context) | |
{ | |
// Migrate data, but only for versions older than 1.2 | |
if (context.previousVersion != null && context.previousVersion().CompareTo(new Version (1,2)) < 0) | |
{ | |
UpgradeForFeature12(); | |
} | |
} |