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
public with sharing class WeekEightHomework { | |
//Assignment: The following method is supposed to create the number of accounts specified in the argument that it takes. | |
//Each Account should be named 'Sample Account #sampleNumber' where sample number is the count. So if you created 2 Accounts | |
//one would be called 'Sample Account 1' and the other 'Sample Account 2' | |
//Also, when we're done inserting them, we will create a case for each one with a Status of 'New', Origin of 'New Account' and the | |
//desription and subject of your choice. | |
//This isn't working quite right. Can you use your debugging skills to fix it? I had to comment it out since it won't compile |
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
//My homework choice is AccountTriggerGood: | |
//This is a better example of a trigger. It uses a trigger handler to carry out business logic, | |
//and it only accepts parameters that have related trigger handlers. It also doesn't have unused if/else statements. | |
//As a developer works on this trigger in the future, they can easily see when they're writing new trigger logic, or expanding | |
//on existing logic because the trigger is readable and doesn't have unsued code just hanging out. | |
trigger AccountTriggerGood on Account (before insert, before update, after insert, after update) { | |
// First, we have a simpler if/else if block separating inserts from updates | |
// This helps trigger performance and keeps triggers with lots of handlers more readable |
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
public with sharing class WeekSixHomework { | |
public static void soqlPractice() { | |
//1. Below is a SOQL query that should be returning the top 5 Accounts in our org based on Annual Revenue. | |
//Something's not quite right, can you fix the query? | |
List<Account> topFiveAccounts = [SELECT Id, Name, AnnualRevenue FROM Account | |
WHERE AnnualRevenue != NULL | |
ORDER BY AnnualRevenue DESC | |
LIMIT 5]; |
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
public with sharing class WeekFiveHomework { | |
// Remember Sets & Maps?? We did a little practice with Lists in week 2, but we need to make sure we know how to use Sets & Maps as well!! | |
public static void setsReview(){ | |
//Your assignment: Play with Sets! | |
// 1. Create a set of Strings and add at least 5 entries | |
Set<String> SalesforceProducts = new Set<String>(); |
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
public with sharing class WeekTwoHomework { | |
public static void introToConditionals() { | |
/*Comparison and logical operators are an important tool and one that we'll dive into much deeper with Conditional Statements next week. | |
For now, let's just get familar with some of the syntax.*/ | |
//First, let's get some variables that we can work with | |
//A single equals sign such as =, signals that we're assigning a value to a variable |
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
public with sharing class CommentingOnCodeExercise { | |
/** | |
* Your Assignment is to add comments describing what is being done in the methods below. | |
* Call out the concepts you learned in your readings and in class. | |
*/ | |
public static void cartValues() { | |
//Declaring a new variable with DataType of Integer and Name as minimumCartValue, then assigning a value of 50. |
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
Making a cup of Coffee: | |
Get Utensils and Ingredients | |
Get Coffee Cup | |
Get Spoon | |
Get Coffee Machine | |
Get Coffee Capsule | |
Get Milk | |
Get Sugar | |
Get Water |
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
public with sharing class WeekOneHomework { | |
public static void introToPrimitives() { | |
//Primitives are the simplest elements in a programming language | |
/* A selection of primitives in Apex: | |
Integer: A number that does not have a decimal point, like 1 or 789 or -34 | |
Decimal: A number that includes a decimal point like 1.34 or 456.78907654 | |
String: Any set of characters surrounded by single quotes, like 'Apple' or 'I Love Strings' or '2 Legit 2 Quit' |
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
public with sharing class Welcome { | |
//Welcome! I'm a comment and I'm here to tell you what this particular class file is for. The developer who created this class added | |
//me so that future developers, like yourself, would have a quick little introduction to what this class does. | |
//The two little slashes tell the compiler* that everything following on this line is a note | |
//for humans and not code that needs to be executed | |
// (* A compiler is the computer program that translates this code into executable computer instructions) | |
//But you know what? This set of comments is already several lines long and getting longer. I'm tired of typing two slashes every time |