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:component controller="ApprovalRequestCommentsController" access="global"> | |
<apex:attribute name="relatedToId" assignTo="{!targetObjectId}" type="String" description="ID of the record whose last approval comments to retrieve"/> | |
<table cellpadding="5" style="border-collapse: collapse " width="800" border="1"> | |
<tr> | |
<td style="background-color: #0099CC; color: #FFFFFF" width="300"> | |
<b>Date</b> |
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 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 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. | |
//declare a method called cartValues | |
public static void cartValues() { | |
//declare an integer and assign it a value | |
Integer minimumCartValue = 50; |
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
//Accessed with Custom button on the Account object on the Household details page layout. | |
<apex:page standardController="Account" sidebar="false" lightningStylesheets="true" showHeader="false"> | |
<h1 style="text-align:center;color:blue;"> | |
The {!Account.Name} | |
</h1> | |
{!Account.BillingStreet} | |
{!Account.BillingCity}, {!Account.BillingState} {!Account.BillingPostalCode} |
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 WeekFiveHomework { | |
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 != 0 | |
ORDER BY AnnualRevenue DESC | |
LIMIT 5 ]; |
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 AccountAddressTrigger on Account (before insert, before update) { | |
// Get the List of accounts | |
//List<Account> newAccts = new List<Account>( | |
//[SELECT Id,Match_Billing_Address__c,BillingPostalCode,ShippingPostalCode FROM Account WHERE Id IN :newAccts]); | |
for(Account alice : Trigger.New) { | |
if (alice.Match_Billing_Address__c == true) { | |
alice.ShippingPostalCode = alice.BillingPostalCode; | |
} |
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
//Week 6 Homework: Properly bulkify this code: | |
List<Case> newCases = new List<Case>(); | |
Id runningUserId = UserInfo.getUserId(); | |
//Get the email address for the Account owner. | |
//move the SOQL query outside of the loop. | |
User u = [SELECT Id, Email FROM User WHERE Id = :runningUserId]; | |
for (Account a : Trigger.new) { | |
Case c = new Case(); |
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
//written by Bobby Watson | |
public void OnBeforeInsert(Quote [] newQuotes){ | |
Set<Id> opportunitiesToQuery = new Set<Id>(); | |
// Loop over the new quotes and grab the opportunities they are associated to. | |
for (Quote q : newQuotes) { | |
opportunitiesToQuery.add(q.OpportunityId); | |
} | |
// Now we have a collection of opportunity IDs to query. So let's query for them. |
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 WeekSevenHomework { | |
//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 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 Handler to create a follow-up task when an email is send through Salesforce's "send an email button" | |
// based off of Kieren Jameson's Cooking with Code: A Tasty Trigger Treat | |
// http://womencodeheroes.com/2015/07/cooking-with-code-a-tasty-trigger-treat-apex-triggers/ | |
public class TaskTriggerHandler { | |
// declare a method, which accepts a list of tasks (EmailList) as a parameter. | |
public static void createNewTask (List<Task> EmailList) { | |
// Set up Due Date variable for the new tasks, which is 1 month from today | |
Date dDate = Date.today(); // set's today's date |
OlderNewer