Apex Specialist

Superbadge – Apex Specialist

trailhead_superbadge_apex

I have completed the Apex Specialist Superbadge recently and have got 5000 points. Since I see some folks are having issues passing the challenge – thought of putting the configuration and code developed for the same. The details, requirement & Use Case is provided at the Trailhead website Superbadge Apex Specialist.

 

Step 1 :  Install this unmanaged package. [ https://login.salesforce.com/packaging/installPackage.apexp?p0=04t36000000i5UM ]

follow the instruction given on trailhed site to install this package.

Step 2 : Rename Case with Maintenance Request

Step 3 : Rename Product with Equipment

for rename follow this  ==> Setup –> Customize –> Tab Names and Labels –> Rename Tabs and Labels

As you install the package the required custom object and the dummy classes will automaticlly created for you.

Step 4: Now from here your super badge is starting . before processed further please go threw the requirements of this super badge on trailhed site.

superbadges_Apex_images_image_0_d1b7610d2dc3487a22ecd01263bf1ced.png

schema builder.png

Create classes and triggers as follow :

 

Create Trigger “‘MaintenanceRequest”  

Create trigger helper class “MaintenanceRequestHelper”

trigger MaintenanceRequest on Case (before update, after update) {
//         call  MaintenanceRequestHelper.updateWorkOrders  ......

 

public class MaintenanceRequestHelper {
            public static void updateWorkOrders(Map<Id, Case> applicableCases){ ......

 

Create Test class “MaintenanceRequestTest

@isTest
public class MaintenanceRequestTest { ......

 

you can find the complete code over the git repo –  [https://github.com/amitjpr/Thailhead-Solutions/tree/master/Superbadges/Apex]

 

Advertisements

3 thoughts on “Apex Specialist

  1. Hi!

    Thanks for this post! I got two question where I cant understand your code. Could you please clarify that for me?
    1. One of the requirements was that if a Maintenance Request (Case) has several Work Parts related to it, the Due Date of the Maintenance Request shall be calculated by taking the Lifespan of the Work Part related Product that has the shortest lifespan. Where is this requirement reflected in your code? It appears to me your code simply takes randomly the lifespan of a related product.

    2. In the class “MaintenanceRequestHelper” you create the Map “mapProduct” by putting the Product-Id as the Key and the Lifespan as the related value. Later on, when you create the case you pass the Case-Id into the map to get the lifespan (mapProduct.get(a.Id) ). I cant understand how this can possibly work as you have Product-Ids available a the Key.

    Thanks in advance for your help and keep up the great work!

    Best regards.
    Michael

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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