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
//Provide the id of the default user for new leads or the default queue for new leads so we can make sure we only get rid of these leads | |
String ownerId = '00Go0000001iGfU'; | |
//Start with a list of all leads with email addresses that are not converted (and in our case not currently with a status of Duplicate) | |
//Also pull owner ID so we can use that to determine if the leads are owned by the new lead queue (or not) | |
List<Lead> newleads = [select id, email, ownerid from Lead where email != null and isConverted = false and Status != 'Duplicate']; | |
//Create a map, indexed by email, that will store lists of leads with the same email address | |
Map<String, List<Lead>> leadsByEmail = new Map<String, List<Lead>>(); |
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 CreateAccountFromContact on Contact (before insert) { | |
//Collect list of contacts being inserted without an account | |
List<Contact> needAccounts = new List<Contact>(); | |
for (Contact c : trigger.new) { | |
if (String.isBlank(c.accountid)) { | |
needAccounts.add(c); | |
} | |
} | |
if (needAccounts.size() > 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
You'll want to create a custom setting in Salesforce to store API keys, portal IDs and product__c mappings. | |
The settings should be named SendToHubSpot (SendToHubSpot__c) and have the following fields: | |
API Key 1 (API_Key_1__c), text(50) | |
API Key 2 (API_Key_2__c), text(50) | |
Portal ID 1 (Portal_ID_1__c), text(10) | |
Portal ID 2 (Portal_ID_2__c), text(10) | |
Portal 1 Product Values (Portal_1_Product_Values__c), text(255) | |
Portal 2 Product Values (Portal_2_Product_Values__c), text(255) |