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
<aura:component implements="forceCommunity:availableForAllPageTypes,force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="public"> | |
<aura:attribute name="contactRecord" type="Contact"/> | |
<aura:attribute name="recordError" type="String"/> | |
<aura:attribute name="returnedError" type="String"/> | |
<force:recordData aura:id="recordLoader" | |
recordId="{!v.recordId}" |
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
({ | |
changeNameToSusie: function(cmp, event, helper) { | |
console.log("LDSErrorTest.handleRecordUpdated: entered"); | |
var contact = cmp.get("v.contactRecord"); | |
console.dir(contact); | |
contact.FirstName = "Susie"; | |
cmp.set("v.contactRecord", contact); |
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
public with sharing class Part2SOQLExercises { | |
public static void funWithAggregates () { | |
//1) | |
//Let's create a query to count how many opportunities we have that are over $100,000 dollars | |
//Since we're just getting a count, we can put the result directly intp an integer variable | |
Integer bigOppsCount = [SELECT COUNT() FROM Opportunity WHERE Amount > 100000]; | |
System.debug('We have ' + bigOppsCount + ' Opportunities over 100K'); |
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
public with sharing class ContactTriggerHandlerV2 { | |
//Variables to store Trigger.oldMap & Trigger.newMap | |
Map<ID, Contact> oldContactsMap; | |
Map<ID, Contact> newContactsMap; | |
//Constructor that takes in the map of old contact records and new/updated contact records and assigns them to class variables | |
public ContactTriggerHandlerV2(Map<ID, Contact> oldTriggerContacts, Map<ID, Contact> newTriggerContacts) { | |
oldContactsMap = oldTriggerContacts; | |
newContactsMap = newTriggerContacts; |
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
public with sharing class ContactTriggerHandlerV3 { | |
//Has the Contact trigger already executed? | |
public static boolean hasExecuted = false; | |
//Variables to store Trigger.oldMap & Trigger.newMap | |
Map<ID, Contact> oldContactsMap; | |
Map<ID, Contact> newContactsMap; | |
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 ContactTriggerV3 on Contact (before insert, before update, before delete, after insert, after update, after delete, after undelete) { | |
/***************This Trigger should only be run ONCE******************/ | |
if( ContactTriggerHandlerV3.hasExecuted ){ | |
return; // prevent recursive re-entry | |
} | |
ContactTriggerHandlerV3.hasExecuted= true; | |
/*********************************************************************/ |
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
//Object Oriented Class that represents our Stock_Item__c Object and provides abstracted functionality | |
public with sharing class StockItem { | |
//class variables defined here | |
public String sObjectID; | |
public Decimal listPrice; // ex 3.4 signifies $3.40 | |
public String name; | |
public String description; | |
public Integer minimumStockNeeded; |
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
public with sharing class SampleBadMethods { | |
public class SampleCustomException extends Exception{} | |
//This method throws a custom exception, because we have a specific data requirement (positive integers) | |
//Without the custom check and exception, this code would run, but not meet our specs | |
public static Integer iAddUpPositiveIntegers (Integer intA, Integer intB) { | |
//First validate that we have positive integers only |
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 | |
private class HandleBadMethodsTest { | |
@isTest | |
static void testCustomException() { | |
//validate that our method will reject negative integers | |
Boolean exceptionWasThrown = false; | |
try { |
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
<apex:page standardController="Account"> | |
<apex:form> | |
<apex:pageBlock title="My Content" mode="edit"> | |
<apex:pageBlockButtons> | |
<apex:commandButton action="{!save}" value="Save"/> | |
</apex:pageBlockButtons> | |
<apex:pageBlockSection title="My Content Section" columns="2"> | |
<apex:inputField value="{!account.name}"/> | |
<apex:inputField value="{!account.site}"/> | |
<apex:inputField value="{!account.type}"/> |
OlderNewer