function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Evan KennedyEvan Kennedy 

Apex Super Badge - Incorrect Requirements

I'm trying to verify the first step of the apex super badge, located here: https://trailhead.salesforce.com/en/super_badges/superbadge_apex

The requirements state: "When an existing maintenance request of type Repair or Routine Maintenance is Closed, you create a new maintenance request for a future routine checkup. This new request is tied to the same vehicle and piece of equipment to be serviced as the original closed service request. This new request's Type should be set as Routine Maintenance."

However, when attempting to verify the step, this is the error I get:

"Challenge Not yet complete... here's what's wrong: 
Inserting a new Maintenance Request of type 'Repair' and then closing it did not work as expected. The challenge was NOT expecting to find a Maintenance Request with the same Vehicle and the Status of 'New' and of Type 'Routine Maintenance'. However, it did."
NagendraNagendra (Salesforce Developers) 
Hi Evan,

Please find the below post from the developer's community which has some extremely good insights and tricks in order how to complete the above challenge.

https://developer.salesforce.com/forums/?id=906F0000000kEG5IAM

Please let us know if you are looking for something more.

Kindly mark this post as solved if it helps.

Best Regards,
Nagendra.P
Emmanuel Bruno 8Emmanuel Bruno 8
I agree, the requirements are still not correct, 3 years after your post.
I got the same message and finally succeeded to submit the challenge by excluding cases with type =='Repair' from the trigger process. But yes you're right it's the opposite of the requirements : "When an existing maintenance request of type Repair or Routine Maintenance is Closed, you create a new maintenance request"
Unless I missed something ?
BCDave SeidmanBCDave Seidman

This was maddening, and thank you, Emmanuel, for pointing me in the right direction. In my code, it was not as simple as excluding cases with type=='Repair' from the trigger process.

The trick, for me, to pass the requirement was to only set the Vehicle value if the Type=='Routine Maintenance'; otherwise, leave it null; of course, that is counter to the requirement, but it was the only way to get past this

newMaintenanceRequest.Vehicle__c = closedMaintenanceRequest.Type == 'Routine Maintenance' ? closedMaintenanceRequest.Vehicle__c : null;

PS - Nagendra's link is dead
glossy cafeglossy cafe
thank you for visiting here:
http://nbiclearance.website/