Teach Me Salesforce

A community approach to learning salesforce.com

Apex Workshop Webinar 8: Invocable Apex

leave a comment »

The video for the workshop session on Invocable Apex Classes can be found on YouTube here:

The original source is from a presentation at Dreamforce ’16 based on https://github.com/mshanemc/processBuilderBlocks.
In our session we worked with:
PBB Lock:
https://github.com/mshanemc/processBuilderBlocks/blob/master/src/classes/PBBLock.cls
PBB Delete:
https://github.com/mshanemc/processBuilderBlocks/blob/master/src/classes/PBBDelete.cls
PBB Utility (dedupe):
https://github.com/mshanemc/processBuilderBlocks/blob/master/src/classes/PBBUtilities.cls

Ohad’s String Utility

Advertisements

Written by Always Thinkin

July 8, 2017 at 6:54 pm

Posted in Apex, Beginner, Code Sample

Apex Workshop Webinar 7: Classes

leave a comment »

The video for the workshop session on Apex Classes can be found on YouTube here:

The triggers and their unit tests for practicing are available here:


Written by Always Thinkin

July 8, 2017 at 6:09 pm

Posted in Apex, Beginner, Code Sample

Apex Workshop Webinar 6: Triggers

leave a comment »

The video for the workshop session on Apex Triggers can be found on YouTube here:

The triggers and their unit tests for practicing are available here:


Written by Always Thinkin

July 8, 2017 at 5:43 pm

Posted in Apex, Beginner, Code Sample

Apex Workshop Webinar 5: Control Flow

leave a comment »

The video for the workshop session on Apex Control Flow can be found on YouTube here:

The worksheets for practicing are available here:

Answers:

Written by Always Thinkin

July 8, 2017 at 5:34 pm

Posted in Apex, Beginner, Code Sample

Apex Workshop Webinar 4: SOQL

leave a comment »

This workshop introduces SOQL, the query language used to retrieve data from Salesforce in Apex. Building on what we learned in the previous workshop about Collections, you’ll learn how to populate Lists and Maps using SOQL statements. We also learn about the best practice of collecting your records in a Map for DML statements to ensure that you don’t have duplicate records records.



The worksheet below for practicing can be copied directly into a new Apex Class in your Developer Console (you must name the Apex class as indicated). It is a test method which means that you can use Run Tests to see whether your code runs successfully after you uncomment (remove the //) the lines starting with FIX ME! and make changes. It is designed to work with the sample data that comes in every Developer Edition Org.

Practice (name your new Apex Class ‘SOQLqueries’):

Answers (same file as above but with FIX ME lines corrected):

Written by Always Thinkin

July 8, 2017 at 5:25 pm

Posted in Apex, Beginner, Code Sample

Apex Workshop Webinar 3: Collections

with one comment

In the third Apex Workshop Webinar we explored Collections: Lists, Sets and Maps.

In the exercise we again work with an Collections Exercises to practice manipulating Apex Collections (Answers to the exercises here). With Lists we learned different ways to populate a list while exploring the List Methods from the Apex Documentation. We practiced working with List indexes and expanded the concept to Lists of Lists and how to return values from anywhere in them. And we used a simple SOQL query to populate a list and noted how you must include any fields that you want to later reference.

From Lists we moved on to Sets. We described the differences between List (an ordered collection) and Sets (an unordered collection of unique value). We learned that with Sets, you can reference individual collection members by using the contains() Set Method and studied the Set Methods from the Apex Documentation. We also Lists into Sets and observed how duplicate values are automatically de-duped when added to Sets.

With Maps, we emphasize how very essential this collection type is to efficient Apex development. We explored different methods of putting key-value pairs in to Maps and retrieving the data with the keyset() and values() methods. And along the way we checked out the Map Methods from the Apex Documentation.

Through out the exercises, we used the Apex test methods of assert() and assertEquals() to test our work and to familiarize ourselves with unit testing.

Unfortunately we had technical difficulties with the recording and lost the first 20 minutes, but the most important discussions are in the 84 minutes we captured.

Assignment:

Answers:

Written by Always Thinkin

March 20, 2017 at 7:49 pm

Posted in Apex, Beginner, Code Sample

Apex Workshop Webinar 2: Data Types

leave a comment »

Welcome to the written accompaniment to the Apex Workshop Series presented as Webinars in 2016!

This edition of the series introduces Data Types with an examination of the Primitive Data Types described in the official Apex Documentation. We then proceed on to work on an Apex Test Class that gives us a chance to experiment with the concepts as well as get familiar with the Developer Console environment (Answers to the exercises). We explore Test Classes & Methods, System Debug statements and String methods while working with the Debug Logs and the Execute Anonymous panel to see our output. Other Apex programming concepts introduced: String concatenation, escape characters, converting data types, indexes in strings, incrementation and operators.

Assignment:

Answers:

Questions from the live webinar:

  1. What data type are Geolocation fields? Geolocation fields are doubles.

Questions from the Community:

If you watch the video or work on the exercises and have questions, post them to the comments!

Written by Always Thinkin

March 20, 2017 at 7:13 pm

Posted in Apex, Beginner, Code Sample