Skip to content

Instantly share code, notes, and snippets.

View mkorman's full-sized avatar

Mariano Korman mkorman

  • Location-independent
View GitHub Profile
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();
}
}
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();
}
}
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();
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);
}
@isTest
public class TestCreateInitialCallTaskTrigger
{
@isTest
public static void TestInitialCallTaskIsCreated ()
{
Lead l = new Lead (LastName = 'Test', Company = 'Acme');
insert l;
}
}
@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];
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),
@isTest
public class TestCreateFollowupTaskTrigger
{
@isTest
public static void TestInitialCallTaskIsCreated ()
{
Lead l = new Lead (LastName = 'Test', Company = 'Acme');
insert l;
List<Task> createdTasks = [SELECT Subject, WhoId, ActivityDate FROM Task];
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json;
namespace SfQuery
{
public class SalesforceClient
public class SalesforceClient
{
private const string LOGIN_ENDPOINT = "https://login.salesforce.com/services/oauth2/token";
private const string API_ENDPOINT = "/services/data/v36.0/";
public string Username { get; set; }
public string Password { get; set; }
public string Token { get; set; }
public string ClientId { get; set; }
public string ClientSecret { get; set; }