Welcome to the Apex Academy!

Coding Challenge Coding Live

In-depth Apex tutorials that go deeper than anything ever written. Through video, voice, and exercises, I teach you how, and more importantly, why!

Matt Lacey Salesforce MVP and founder of the Salesforce StackExchange

// Step 3: if our case contains a secret keyword, create a child casefor (Case casesWithSecretInfo : casesWithSecretInfo) Case childCase = new Case();childCase.subject = Warning: Parent case may contain secret info;childCase.ParentId = casesWithSecretInfo.Id;childCase.IsEscalated = true;childCase.Priority = High;childCase.Description = At least one of the following keywords were found + secretKeywords;insert childCase;

The 1 is actually an i. Number vs letter!

// Step 1: Create a collection containing each of our secret keywordsset secretKeywords = new Set();secretKeywords.add(Credit Card);secretKeywords.add(Social Security);secretKeywords.add(SSN);secretKeywords.add(Passport);secretKeywords.add(Bodyweight);

I can see there are videos for Apex and Visualforce on SFDC99 which are free. The ApexAcademy on Pluralsight.com has 3 salesforce videos put by you and they are paid. What is the difference between vidoes on SFDC 99 and ApexAcademy. I believe ApexAcademy has more videos than SFDC99, is this true?

David,I viewed the first module of Apex Academy this morning and I am excited to complete the course.However, it is not clear to me what the prerequisites are. It seems you are saying that I would need experience in Salesforce Admin. You make reference to Trailhead. But, there such a large amount of info and so many directions to go within Trailhead it is bewildering.Would you please explain what the prerequsites are so that even I can understand?

Try removing lines of code one by one until you find the broken one!

Dev console for now =) Then one day maybe the Force.com IDE!

Various Salesforce MVPs Certified Technical Architects!

Force.com Platform The Big Picture

Sara Morgan, Certified Salesforce Advanced Developer

// Loop through all of our prices find the lowest oneDecimal lowestPrice;Integer lowestPricePosition;for(Integer i = 1; i=CompetitorPrices.size(); i++)Decimal currentPrice = CompetitorPrices.get(i);if(lowestPrice == null currentPrice lowestPrice)lowestPrice= currentPrice;lowestPricePosition = i;

Connected my MavensMate to my salesforce org and created project and launched the sublime text within desktop app.One more thing I notice in the Sublime- MavensMate – Settings , it is different User settings from one in your videos.

I have experienced the same thing. and also the look and feel of the setup is changed now compared to the one in video. But yes, it does update name to Hello World when i create a new lead.

Yes David, I created a brand new fresh DEV edition instance and have copied your code word to word, comma to comma. What could be wrong? I dont want to fall at the very first trigger I ever tried, so please let me know if there is any way to debug.Thanks in advance for your time!Best regards,RC

/*Product purchased on andcase created on .Warranty is for and is through its warrantyperiod. Extended warranty: Have a nice day!*/

Should I take the Apex Academy or follow along the tutorials on SFDC99/Trailhead?

trigger HelloWorld on Lead (before update) for(Lead 1: Trigger.new) 1.FirstName = Hello;1.LastName= World

I say use the dev console or the Force.com IDE for now. The core concepts are all the same regardless of which code editor you use, so you should be fine!

Im still learning myself, I think the variable name was supposed to be L in lower case, when reading it looks like a number one. I would use numbers at the end of the variable name just like you did if I need to use numbers at all. Cheers!

Dan Appleman author of Advanced Apex Programming and one of my personal mentors

Im currently taking the Apex Academy course on Pluralsight and love it!The amount of detail you explain is very helpful and I feel like I am learning a lot!!!

Smart move there are manybenefits to a corporate subscriptionat PluralSight!

I switched from Linux to windows. I wanted to download Mavensamet again. but for some reason, I wasnt able to install it. I am sure you must be aware of this issue.I switched to Visual Studio Code. I will start apex academy course again from scratch. As all of your lectures are in Mavensmate. Hows its going to work out? Please advise.

//Step2 : Check to see if any of our case contains secret keywordsList casesWithSecretInfo = new List();for(Case c : Trigger.new)if(c.Subject != childCaseSubject)for(String k : Keywords)if(c.Description!= null && c.Description.containsIgnoreCase(k))casesWithSecretInfo.add(c);System.debug(Case + c.Id + Include secret Keyword +Keywords);break//Step3: IF our case contains a secret keyword, Create a child caseList casesToCreate = new List();for(Case Sinfo : casesWithSecretInfo)Case childCase = new Case();childCase.subject = childCaseSubject;childCase.ParentId = Sinfo.Id;childCase.IsEscalated = true;childCase.Priority = High;childCase.Description = Atleast one of the following keywords are found + Keywords;casesToCreate.add(childCase);

Result: [OPERATION FAILED]: triggers/CheckSecretInformation.trigger: Illegal assignment from List to List (Line: 12, Column: 13)

I have searched quite a bit on the subject and cant find anything like what Im proposing.So, Im beginning to believe a trigger is not the right approach.Any advice you can offer would be much appreciated.

I am learning Apex through Apex Academy. I copy this code from your video tutorial on Pluralsight. FYI I am new to Apex.Here is the code that I copiedtrigger OppPriceCompetitor on Opportunity (before insert, before update)for(Opportunity opp : Trigger.new)//Create the list to store all the pricesList CompetitorPrices = new List();CompetitorPrices.add(opp.Competitor_1_Price__c);CompetitorPrices.add(opp.Competitor_2_Price__c);CompetitorPrices.add(opp.Competitor_3_Price__c);

trigger CheckSecretInformation on Case (after insert, before update)

I am new to SF, never coded before but works in IT since 5 years. I absolutely do not know coding ex. Java or C++, but eager to learn. I am learning Java from the Head First Java book but still its baby steps. If I subscribe to apex academy do I have to fully know Java or Javascript or HTML to master apex and visualforce?

My employer would like to start capturing the GPS data (Latitude-Longitude) when a Rep checks-in.I wonder if it makes sense to fire a Trigger when the In Progress checkbox ISCHANGED to True,and run a JavaScript function to capture the GPS data?

ActionFunctions action method also works as synchronous right?

You can start with 0 or 1 =) If 0 isnt interesting for you, skip!

//populate the leading competitor field with the competitor maching the lowest price positionopp.Leading_Competitor__c = Competitor.get(lowestPricePosition)//Create the list to store all the prices// Loop through all of our prices find the lowest one// //Note the list position of our lowest priceAnd I am getting this error messageError: Invalid Data.Review all error messages below to correct your data.Apex trigger OppPriceCompetitor caused an unexpected exception, contact your administrator: OppPriceCompetitor: execution of BeforeInsert caused by: System.ListException: List index out of bounds: 3: Trigger.OppPriceCompetitor: line 22, column 1Please help me !!

And installed sublime text seperately .

Error Error: Compile Error: Unrecognized symbol f, which is not a valid Apex identifier. at line 4 column 11

I have been coding with apex for months now exclusively to control data internally, however there is a tremendous need in my company for integration services and we dont want to go to a vendor to do so. I am currently enrolled in the dev502 course integration with force.com but it seems (after the first day of class) that this course assumes a lot and i am completely new to webservices. It also contains a lot of exercises that focus on using java or c which blows my mind since i was under the assumption salesforce would want to promote apex and i am not familiar with java or c. So i am already thinking this course was a waste of time and money. The trailhead modules also assume a lot and do not get into the neddie gritty. The developer guide might as well be written inhieroglyphics. The pluarsight video with Richard also glosses over the basics and isnt helpful at all for absolute beginners new to coding and new to the concepts of webservices. i need a lot of hand holding and comprehensive step by step instructions. HELP!!!!

Thank you David and thank you for all you do!

We cover that, keep on continue with the tutorials =)

Course 3: The Power of SOQLThe key to awakening the power of Apex lies in SOQL yes this is the course where you become all-powerful in Salesforce! Learn how to write SOQL queries, how to integrate SOQL in your Apex triggers, and how to defend your org from bugs by using SOQL in your test classes.

Very strange! Make sure youre using a brand new org when doing any of the exercises

Decimal HighestPrice;Integer HighestCompetitor;for(integer i=0; i HighestPrice)HighestPrice = CompetitorPrices.get(i);HighestCompetitor = i;

Any feedback would be greatly appreciated.

Don Robins creator and teacher of Salesforces official Apex classes

Hey David. Thanks a lot for all these courses. But I request you to please make a video tutorials for salesforce integration with third party. I am really looking forward for this course. Your teaching style is just awesome. You explain things in depth. Please help people like me who are new to salesforce with some more courses. Best of luck for your future!

The Apex Academy vids go deep in depth and are meant to be a one stop shop to learn. =)

Dan Appleman author of Advanced Apex Programming and one of my personal mentors

I am getting the same exact error. Even spun up a new developer org think it was my org nope same error. Removed the first name line and only had last name and it came up with same error but instead of f it was lHere is my code copied from my developer org as I wrote it.

You are welcome to ask your questions here =)

Hope I can have more for ya in the future!!!

Dan Appleman author of Advanced Apex Programming and one of my personal mentors

When I tried, the page has been reloaded and the action performed as expected. Doesnt AJAX reload the page right?

Is that the action event n the command button work as asynchronous or synchronous?

Try using more System.debug() to get to the bottom of this one =)

I am writing you to kindly ask you if you know about a tutorial or a site which explains (in a really easy way) how to create a webservice which integrates Salesforce with another CRM, like Siebel. The idea is to create something that allows to create and/or update accounts from Salesforce to Siebel.

I also faced this issue last month but when i tried doing same today, it worked fine. So is it something related to the critical updates we get in our org?

//Step2: Check to see if any of our case contains secret keywordsList casesWithSecretInfo = new List();for(Case c : Trigger.new)if(c.Subject != childCaseSubject)for(String k : Keywords)if(c.Description != null && c.Description.containsIgnoreCase(k))casesWithSecretInfo.add(c);// System.debug(Case);break//Step3: IF our case contains a secret keyword, Create a child caseList casesToCreate = new List();for(Case Sinfo : casesWithSecretInfo)Case childCase = new Case();childCase.subject = childCaseSubject;childCase.ParentId = Sinfo.Id;childCase.IsEscalated = true;childCase.Priority = High;childCase.Description = Atleast one of the following keywords are found+ Keywords;casesToCreate.add(childCase)insert casesToCreate

Scott Lee Director @ Elega Corp

But if youre looking for the best possible opportunity to learn to code and you want your hand held throughout the entire process, the Apex Academy is for you!

Dont give up =) Keep at it! It is a difficult challenge!

I have taken the Beginners guide to Coding in Salesforce and enjoyed it thoroughly! I am now on Fundamental Salesforce Coding Technics. I am stuck on one of the sections Variable Practice Part 2. For the life of me I am getting an error message which I cannot seem to resolve =Result: [OPERATION FAILED]: triggers/WarrantySummary.trigger: Expression cannot be assigned (Line: 11, Column: 34)

What other coding editor will you recommend since mavensMate is no longer available?

Anything on Javascript, the required language for Salesforce Lightning!

Such a shame! Youll want to use dev console for now =)

Thank you Harsha, I believe in ya!!!

Just finished your first three Apex Academy courses and I HAVE to say Thank You! Ive been trying to learn to code for a little while now but even with multiple written tutorials, trailhead, and practice doing reverse engineering of prebuilt code, something just never fully clicked. Finally after watching your videos, it makes sense to me!! Your courses are not only super easy to follow and expertly explained, but you also do the best job at making them engaging theyre like a great book you cant put down! Im so excited to have this tool of coding under my belt. Cant wait to put it into practice as well as tell employers now that, YES, I know basic coding; I can be an admin hero AND make their dream customizations a reality. 😉 Also cant wait for your next courses to come out! Thank you again.

Will you be providing scholarships to the Apex Academy?

//Step1: Create a collection of our secret keyeordsSet Keywords = new Set();Keywords.add(CreditCard);Keywords.add(Social Security);Keywords.add(SSN);Keywords.add(Passport);

Error Error: Compile Error: Unrecognized symbol f, which is not a valid Apex identifier. at line 4 column 11

could you please provide me an insight on this ?

I wish we get few more Apex Academy courses this year..

I strongly believe that you can help me to sort out this concept issue.

Students, youve waited long enough theApex Academyis now LIVE!

Have you utilized Visual Studio Code Extension? I have started the Apex Academy and I am at the part to download MavensMate, but if you go to mavensmate.com you will notice a letter from Joe saying that he is ending its development. He references to use the Visual Studio Code Extension. Is this an okay substitute for the course?

Ive started learning java a year ago because I read somewhere that was the language to know to learn apex. After feeling comfortable with the core classes in java I was having trouble finding a apex ciricumlum that would easily help me transition from Java to apex. Until I found you! Im in the middle of your second course on plural sight and you are great at explaining the fundamentals and made it so easy for me to transfer what I learned and fit it into apex. I feel encouraged and energized after finishing each module and feel Im on the right path of becoming a admin/developer duel threat. No more project hold ups at my job because we dont have the available developer resources to contribute. I can be that guy. And the best thing is I dont have to invest $4,500 in the salesforce university apex courses. Please continue to produce these videos especially on integration. Thats essentially what every org needs. Thanks again David!

Adam Purkiss Salesforce MVP and Trailhead Architect

Switch to dev console, MavensMate is dying unfortunatel!!

Course 4: Enterprise-Grade ApexLaunch date TBD!

Whats next for the Apex Academy?

Course 1: Absolute Beginners Guide to Coding in SalesforceWant to learn how to code in Salesforce but scared to start? This course is for you! Well give you a crash course on Salesforce development and teach you how to write, test, and deploy Apex triggers. No programming experience required anyone can code!

Ive just subscribed to Apex Academy. Im just curious as to when the launch dates of new courses is set to be? Cheers

The Problem is with your for loop.Change followingfor(Integer i = 1; i=CompetitorPrices.size(); i++)tofor(Integer i = 0; iCompetitorPrices.size(); i++)

Thanks for great video. I watching and learning alot from it.

Course 5: Building End-to-End Salesforce ApplicationsLaunch date TBD!

Hello David,The seems to closed now, they made it as plugin to visual code. I tried doing it and failed.

@david I am getting this error on my very first few lines

Dan Appleman author of Advanced Apex Programming and one of my personal mentors

The Apex Academy is my legacy in this world.Ive worked so hard, and sacrificed so much already to make it. This academy HAS to be perfect. I believe if you work hard enough on a goal and pour all your heart into it that you can create a masterpiece. The Apex Academy is my masterpiece to you and I will do everything it takes to make sure you achieve your goals through it!

Thanks for sharing! Very strange!! I wouldnt worry too much about it for now. Im going to test this out on my own when I have some time!!

//Create the list to store all the CompetiotorsList Competitor = new List();Competitor.add(opp.Competitor_1__c);Competitor.add(opp.Competitor_2__c);Competitor.add(opp.Competitor_3__c);

@David, Can we expect some new Apex Academy courses anytime soon.

I practice one of the trigger Check Secret Info On Case Object in new developer org. It doesnt give me any error but it doesnt create child case.Again I am new to Apex programming so I dnt understand Why this trigger is not working.

I am basically a java developer, Few days back I have started the salesforce Journey using your PluralSight videos. Now, I have a clear understanding of the triggers and workflows. Visual force action calls are a bit confusing for me with respect to sync and async perspective, due to the Spring Java web development knowledge.

I am learning a lot about triggers from your tutorials from Apex Academy. I have a question. Apex class is a code that tests other code, in our case apex triggers. The Hello World trigger, where before updating the lead, the leads first and last name is updated to what we have specified in trigger. When we write test class for the same lead is created and lead is updated with company name, this is the test class with 100% coverage of the Hello World trigger. How come the test class does not check the value of first and last name of the lead after it is updated? Because manually we check first and last name after the lead is updated in Salesforce UI, but it is never part of test class and this test class has 100% coverage. What is that I am missing here?

Ive finished all the Apex Academy videos, what else should I watch?

David, any feedback on why this worked and 1.FirstName did not?

Ive finally have gotten around to taking your classes on Plural Sight. So far so good, but Im stuck on the check secret info trigger. I wrote everything down the way you presented it.

Hey David, I am in the process of the Apex Academy Absolute Beginners Guide to Coding. In that video you use MavensMate which I have used before when trying to learn code a couple of years ago. I was wondering since it is no longer supported is there another coding editor you now use? While testing my Apex Class in MavensMate, it no longer gives the breakdown of what the issue is, they only show you if you are 100% covered which doesnt help me much 🙂 Any advise on any others I should check into? Thanks so much

Course 0: Knowing When to Code in SalesforceCourse 1: Absolute Beginners Guide to Coding in SalesforceCourse 2: Fundamental Salesforce Coding TechniquesCourse 3: The Power of SOQL

No more open-ended tutorials. No more uncertainty over whether youre on the right learning path. No more supplementary Head First Java books! Ive designed this academy to be the only resource you need to become a Salesforce developer.

As long as it works, youre good!!

Agree. I think this material its not that much

trigger WarrantySummary on Case (before insert)

I gotta make that more clear in the v

Email me atsfdc99.nd Ill get you in touch with a PluralSight contact!

Here is the code for that trigger//It has the list of keywords and it checks the cases with those keywords and create a child case.

I have a quick question and wonder if a Trigger is a good fit for this requirement:We have a custom object developed for Client Visits used with the Salesforce1 mobile app on Android.A quick-action button performs Check-in = Date/Time field updated with NOW()Another workflow updates a checkbox named In Progress as true.

// Step 2: Check to see if our case contains any of the secret keywordsList casesWithSecretInfo = new List();for (Case myCase : Trigger.new) for (String keyword : secretKeywords) if (myCase.Description != null && myCase.Description.containsIgnoreCase(keyword)) casesWithSecretInfo.add(myCase);System.debug(Case + myCase.Id + include secret keyword + keyword);break

Thank you for these amazing courses. I am thoroughly enjoying them and my brain is nearly maxed out, but I love it. Question, do you post the solutions to the challenges so that I can check my work? Having trouble with the Secret Information Challenge specifically.

How to use Javascript in Salesforce

I work with MavensMate at work so I definitely know it can work, but honestly not worth it if its giving ya troubles!

Eagerly waiting for this Course 5: Building End-to-End Salesforce Applications from you David, this will give big boost lot of people to work in real job. Hope I will get to see this quick :).

I hear ya, its a tough topic! I dont have any good answers for you now or in the short term, but I hope to help here someday!

Correction, I was able to get the challenge working, YAY!! But I noticed this updates on any edit to the case and want to optimize it to only run when the description is modified. I realize this may be more advanced than where I am today with coding, but happy that these courses have my brain working in such a way.

But then I downloaded the desktop version of Mavensmate from the website :

We start from scratch and assume youve never coded before!

Dont forget to remove all existing code and/or start a brand new dev org before trying any of the exercises!

You gotta debug this one the hard way!

//Populate summary fieldmyCase.Warranty_Summary__c = Product purchased on + purchaseDate + + and case created on + createdDate + .\n+ Warranty is for + warrantyDays + + and is + warrantyPercentage = % through its warranty period.\n+ Extended warranty: + hasExtendedWarranty + \n+ Have a nice day!

I have checked that I have a direct copy from your example

Ive already given out over a hundred scholarships and I intend to continue helping those in need! If youre a veteran, unemployed, or just going through tough financial times, email me atsfdc99.ith your current situation. I have a limited number of scholarships available but Ill do my best to help you out!

Course 0: Knowing When to Code in SalesforceDive into the the pros and cons of various clicks vs code tools such as Apex, Workflow Rules, and Process Builder as we work together to solve a common business scenario. By the end of this course, youll have learned a step-by-step approach to decide whether or not you should use code in your next Salesforce project.

Hi david, you are an inspiration for thousands of aspiring salesforce developers like me.I am a newbie to salesforce. But, I want to tell you I am hoping to be a salesforce developer by this date next year. Ill do everything in my power to achieve this goal

trigger HelloWorld on Lead (before update) for (Lead lead1 : Trigger.new) lead1.FirstName = Hello

A new course every few months on Salesforce coding, best practices, and certifications!

Join the Apex Academyand let me be your mentor. I will personally guide you through all the lessons you need to learn to become an expert Salesforce developer

I am new to coding and I am trying to solve the challenge on Opportunity price wars, I dont seem to get the if condition right for the first challenge which is to update the opportunity based on the highest price.

Below is the code and I checked it line by line. Even deleted the trigger and started again. Is there something obvious to you that I have missed?

Scott Lee Director @ Elega Corp

Great question not too familiar with GPS stuff though so cant give a good answer here sorry!! I am skeptical of triggers for this one though as you also suspect

Dont know if I missed something in your video, but this is how it

for (Case myCase : Trigger.new) Date purchaseDate = myCase.Product_Purchase_Date__c;Datetime createdDate = myCase.CreatedDate;Integer warrantyDays = tValue();Decimal warrantyPercentage = purchaseDate.daysBetween(Date.today()) / warrantyDays;Boolean hasExtendedWarranty = myCase.Product_Has_Extended_Warranty__c;

I wrote it as Highest price not equal to 0, but technically all the prices we input are greater than zero, so I cannot expect it to return one value. I see where the mistake is, but cannot find the solution. Could you please help me?

I am taking Salesforce fundamental coding techniques course on plural sight. So far it is the best Apex course I have taken. I am learning a lot from this course.I am practicing along with the course. I am getting few errors messages when I test my trigger. If I post those error messages would you be able to help me. I am new to apex programming so I am having a hard time to understand why I am getting those error messages.

Career Strategies and Opportunities for Salesforce Platform Developers

when next series will relaese for apex academy?

I recently started the Apex Live Academy on Pluralsight. The course is excellent so far. The only problem I am facing is with practicing it in Mavensmate. I have been able to successfully install Mavensmate but it is behaving differently for me; eg, when I run my test class, it gives me a success message but doesnt give me test coverage results. I was wondering what to do since I dont want to discontinue the course. Please advise. Thanks in advance!

Im interested in getting a subscription for my whole team at work how can I do this?

IMO start learning Lightning, VIsualforce is dying!

I would say start with the free ones and then switch to Apex Academy if youre interested in learning further!

Its synchronous, you probably need a rerender somewhere if youre using VF. GOOD LUCK!

(Also if youre in Lightning, sometimes there are caching issues so newer records dont show up immediately!)

I have a query on the command button.

I am working on the test class portion and I am not sure I am doing it correctly in the dev console. I wrote out the test class and hit the Run Test button, but how do I see the code that failed like it displays in MavensMate?

Ive been going through the Apex Academy courses and theyre great! Probably the most useful training Ive had in my burgeoning development career. Just want to say a big, Thank You! Really looking forward to future courses you create.

Trying to follow your APEX Beginners Guide course but it looks like Mavensmate is no longer available, what should I do?

My SFDC99 tutorials and Trailhead are superb, especially if youre a natural self-learner and youre not afraid to Google things to fill in some blanks.

Hi David,One absolute basic question. I just started with your course and created HelloWorld Before update trigger on lead in a brand new dev instance and have copied the trigger code exactly as you have. But the trigger is firing when I create a new lead. What could be wrong and how do I go about debugging this issue?

Getting Started with Lightning Components

To anyone else who has the same problem, I was able to get it to work by changing the variable 1 to lead1. eg:

Course 2: Fundamental Salesforce Coding TechniquesBehind every advanced Salesforce developer is a strong understanding of fundamental Apex coding techniques. Learn the six core Apex tools: variables, collections, dot notation, IF statements, loops, and DML. There will be multiple live demos of triggers and test classes and lots of homework too!

trigger CaseChild on Case (after insert, before update)String childCaseSubject = Warning: Parent Case may contain secret info;//step1: Create a collection of our secret keywordsSet Keywords = new Set();Keywords.add(Credit Card);Keywords.add(Social Security);Keywords.add(SSN);Keywords.add(Passport);

I can see list of Apex Academy courses. Sorry if this is dumb question I am trying to learn how to code in Salesforce with Apex and Visuaforce. Out of 4 courses below can I start with Course 1 or Course 2 directly, or do I have to start in order specified below?

Check out these other Salesforce courses on PluralSight, authored by people much smarter than me!

Try deleting the trigger and seeing what happens when you create a lead!

Real-world Salesforce examples drawn from my experiences working in over 50 different Salesforce orgs, including Googles!

trigger CheckSecretInfo On Case (after insert, before update)String childCaseSubject = Warning: Parent Case may contain secret info;

Moooost solutions are there in the end =) Sometimes I like to leave it a mystery though!

In the meantime, you gotta learn the hard way.

Leave a Reply