Max your potential with Apex! – Excercise​ 2

Max your potential with Apex! – Excercise​ 2

Last Updated on July 26, 2021 by Rakesh Gupta

As of this point, we have completed several trails on Trailhead and are counting! As a result, we have amassed theoretical knowledge and have some practical experience. But, since our drive to learn Salesforce is insatiable, we want more!

Learning by doing is the key. So, let us look at several hands-on scenarios. By practicing, let us figure out how to identify, design and implement the best solution to solve a problem or a requirement.

Here is the game plan – take bite-size use cases and work on solving them. If you are stuck or get frustrated, reach out to me – I will guide you towards the solution but not solve it for you!

Why just me? It is very likely that a fellow-trailblazer may be your guide instead – remember that, when one teaches, two learn!! So, get the ball rolling and knock out the following use cases!!

Before that check out the previous exercises:

  1. Apex Excercise – 1

Hands-on Excercise

Tim Robinson has recently started working as a Salesforce Developer at GoC. He is using Trailhead and Automation Champion articles as one of the primary resources to learn Apex.

Tim received a requirement from his technical architect to write an Apex trigger that accomplishes the following:

    1. Create a new lead whenever a new user (with profile Marketing User) is created, also add the user into following Public group and Queues:
      1. General Announcements (public Group)
      2. Marketing Hot Leads (Queue)
      3. Newsletter Signup (Queue)
    2. Then auto assigns the following permission set:
      1. View and Edit Converted Leads (Custom Permission Set)
      2. Modify All Leads (Custom Permission Set)
      3. View All Data (Custom Permission Set)
Proofreader: - Munira Majmundar
Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

Preferred Timing(required)

3 thoughts on “Max your potential with Apex! – Excercise​ 2

  1. Hi Rakesh,

    Based on your Apex Exercise – 2 I was able to change the user group and permission set but when I put the if conditonn to check the profile of the user the trigger doesn’t hit.
    for(User U : Trigger.New) {
    if(U.Profile.Name==’Read Only’)
    Please let me know how to proceed.

    1. First, you need to write a query to find user’s profile or use a global variable to find the logged-In user profile details

  2. Dear Raksh,
    I worked on the Apex exercise 1 & 2 that you have provided. I would like to have this reviewed by you and provide feedback and also want to more and more such kind of exercises like that.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Automation Champion

Subscribe now to keep reading and get access to the full archive.

Continue reading