Skip to content

Instantly share code, notes, and snippets.


Jun Chen artminor

Block or report user

Report or block artminor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View LeadTrigger with Custom Metadata
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 < ; i++){
@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'
public class Collections {
static testMethod void Lists(){
//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
You can’t perform that action at this time.