This file contains 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 LeadTrigger on Lead (After Update) { | |
Map<Id, Lead> leadsToUpdate = new Map<Id, Lead>(); | |
List<Competitor__mdt> competitorRecords = [Select Label from Competitor__mdt];//Retrieve our Custom Metadata Records | |
List<String> competitorNames = new List<String>();//Instantiate an empty list to hold the names of our competitors | |
for(Competitor__mdt record : competitorRecords){//Loop through the Custom Metadata records our query returned | |
competitorNames.add(record.Label);//Add them to our empty list | |
} | |
for(Integer i = 0 ; i < trigger.new.size() ; i++){ |
This file contains 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 (seeAllData = true) | |
public class SOQLqueries { | |
static testMethod void relationshipQueries(){ | |
//Child-to-Parent queries are easy. Simply use the API Name of the lookup field to the parent object | |
//and use dot notation to specify the field on that object you want | |
List<Contact> conAccts = [SELECT FirstName, LastName, Account.Name FROM Contact]; | |
//FIX ME! Use a query with a WHERE filter to only return Contacts from the Account named 'sForce' | |
This file contains 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 Collections { | |
static testMethod void Lists(){ | |
//LISTS ARE AN ORDERED COLLECTION OF DATA | |
//How to instantiate a List with some pre-defined values | |
String someword = 'thread'; | |
List<String> threeStrings = new List<String>{'rope', 'twine', someword}; | |
//Lists have methods that allow us to evaluate or manipulate them |