Skip to content

Instantly share code, notes, and snippets.

View kamalpreet-rad's full-sized avatar

kamalpreet-rad

View GitHub Profile
/*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) {
trigger LeadTrigger on Lead (after insert, after update)
{
if(Trigger.isAfter)
{
if(trigger.isInsert)
{
LeadHandlerClass.CreateTask(Trigger.New,Null);
}
if(Trigger.isUpdate)
{
@kamalpreet-rad
kamalpreet-rad / RecipeController.cls
Last active December 7, 2023 00:43
Final Project
/**
* @author : Kamalpreet
* @group : Bulkify
* @created date : 12-01-2023
**/
public inherited sharing class RecipeController {
@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,
@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 (
/*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);
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