Skip to content

Instantly share code, notes, and snippets.

View cynthiabellmcgillis's full-sized avatar
〰️
Vibin'

Cynthia Bell McGillis cynthiabellmcgillis

〰️
Vibin'
View GitHub Profile
if(Trigger.isInsert && Trigger.isBefore) {
//call the class in your handler for before insert
// StockItemHandler.onBeforeInsert(Trigger.new);
//We create a set to accept all the incoming records. Sets don't allow duplicates,
//so this is good for bulk uploads--imagine somemone uploading a CSV of 1000 pot holders.
//We only want the record once!
Set<String> stockItemSet = new Set<String>();
//Starting a for loop to inspect the records coming into the trigger.
for(Stock_Item__c si : Trigger.new){
@cynthiabellmcgillis
cynthiabellmcgillis / DateLogicOppRound2.cls
Last active November 3, 2018 15:40
Second attempt, now with no switch statements!
trigger DateLogicOpp2 on OpportunityLineItem (before insert, before update) {
for (OpportunityLineItem oli :Trigger.new) {
if(oli.ServiceDate !=null){
DateTime startDate = DateTime.newInstance
(oli.ServiceDate, Time.newInstance(12,0,0,0));
if (oli.Materials_Due_2_Weeks__c) {
oli.Materials_Due_Date__c = oli.ServiceDate - (Integer.valueOf(startDate.format('u')) + 11);
@cynthiabellmcgillis
cynthiabellmcgillis / McGillisWeek1Homework.cls
Last active October 12, 2018 21:38
Pseudo code where I lay out the steps to make an egg & mushroom scramble! 🍳
//Get 1 egg from fridge
//Get mushrooms from fridge
//Get carton of egg whites from fridge
//Get olive oil from cupboard
//Get 2 bowls from cupboard
//Get food scale from counter
//Get spatula from drawer
//Get fork from drawer