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
/*A method that includes a query for a List of contacts and returns the Account Name and Industry as well. | |
Use a loop to print the name of each Contact’s Account Name with System.debug.*/ | |
public class WeekTwoHomework | |
{ | |
Public Static void contactwithaccountindustry() | |
{ | |
List<Contact> ctlist = [Select id, FirstName,LastName, Department, Account.Name,Account.Industry from Contact]; | |
for(Contact c : ctlist) { |
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
trigger LeadTrigger on Lead (after insert, after update) | |
{ | |
if(Trigger.isAfter) | |
{ | |
if(trigger.isInsert) | |
{ | |
LeadHandlerClass.CreateTask(Trigger.New,Null); | |
} | |
if(Trigger.isUpdate) | |
{ |
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
/** | |
* @author : Kamalpreet | |
* @group : Bulkify | |
* @created date : 12-01-2023 | |
**/ | |
public inherited sharing class RecipeController { | |
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
@isTest | |
public class RecipeHandler_Testcls1 { | |
@istest | |
static void negativeCheckDraftRecipe(){ | |
//If a recipe is inserted WITH all required fields, it should not automatically be marked as draft | |
Recipe__c r = new Recipe__c ( | |
Name='Pan Cakes', | |
Active_Time__c = 2, |
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
@isTest | |
private class RecipeTriggerHandler_Test { | |
@isTest | |
static void testCheckRecipeInformation_Positive() { | |
// name, active time/units, description and servings should all be reqired on final recipes | |
// if any of these are missing, it should be flagged as a draft.SELECT FROM AcceptedEventRelation | |
// create recipe without all required fields and verify it is marked as a draft | |
List<Recipe__c> recList = new List<Recipe__c>(); | |
Recipe__c rec1 = new Recipe__c ( |
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
/*Create a method that will be called before a recipe is inserted or updated */ | |
public class RecipeHandlerClass | |
{ | |
//to check the missing key values | |
Public Static Void checkRecipeInformation( List<Recipe__c> newRecipies) | |
{ | |
System.debug('newRecipies-->'+newRecipies); |
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 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 |