Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. Udemy would be a paid platform, hence I'll suggest to first exhaust all the free resources and then jump on to Udemy courses. static private Case createNewMaintenanceCase(Id oldCaseId,Id vehicle, Date newDate) { Copy the name of the package and use this command in the terminal. pr.Cost__c = (Integer)productMap.get(cost); } list requestList = new list(); How can we prove that the supernatural or paranormal doesn't exist? Wait for a minute and run it twice maybe before checking challenges. Copyright 2000-2022 Salesforce, Inc. All rights reserved. Home. This repository is for solving all the problems and pass all the challenges in the way of earning this superbadge. if(c.Type == 'Repair' || c.Type == 'Routine Maintenance'){ Vehicle__c vehicle = [SELECT Id, Name FROM Vehicle__c WHERE Name = car LIMIT 1]; Can anyone explain me how getDueDate() function is defined under class: MaintenanceRequestHelper? The challenge is expecting to find the closed Maintenance Request plus an New Maintenance Request of type Routine Maintenance with the same Vehicle as the closed one. I dont see why there would be a Equipment__c lookup established with the Maintenance Request (Case) Object here, since the ERD clearly shows that the link is with the Equipment Maintenance Item Object (which can be found in the related list). newCase.Origin = 'Phone'; Dont forget to create the chatter group , update the product trigger to handle only, Override the New and Edit buttons under the Order object to use the OrderEdit visualforce page. update caseToUpdate; SELECT Maintenance_Request__r.ID cID, MIN(Equipment__r.Maintenance_Cycle__c)cycle Map mapOldCasesWithNewCases = createNewCases(caseList); linkEquipmentsToNewCases(mapOldCasesWithItems,mapOldCasesWithNewCases); }, public static void createNewEquipmentMaintenanceItem(Map newMap){ I want to know that which part of my code is wrong, not just answer. check the solution martland has linked, lemme know if it is working fin Actions to Earn This Superbadge Automate record creation using Apex triggers Level Up with Salesforce and Win Free Certificate voucher! Equipment_Maintenance_Item__c i1 = buildItem(newCases[i_ok].Id, equipment.Id); Thanks for your wonderful gesture of letting know, I am also geating the same error . pr.Warehouse_SKU__c = (String)productMap.get(sku); thanks! I would recommend you to follow the blog rather than looking into the code. As bejng the solo running admin to this page i might not be able to update the solutions on short notice. This is the message I get: I was able to solve it, when trailhead runs the testing is doing a count query to Cases based on the Subject, I didn't put the subject when the case is created as new. Automate record creation | Apex Specialist | Salesforce - YouTube 0:00 / 8:46 Automate record creation | Apex Specialist | Salesforce wonder studies 5.79K subscribers Subscribe 517 Share. Apex Specialist Superbadge Null Reference on Challenge 4. Product2 product = [SELECT Id, Name, isActive, Maintenance_Cycle__c, Replacement_Part__c FROM Product2 WHERE Name = test LIMIT 1]; for(Integer i=1;i<=1000;i++){ Its been long time I completed those quests. } https://th-superbadge-apex.herokuapp.com/equipment’, Salesforce Certification Free Vouchers 2022, How to pass values and call a method from Parent-to-Child Lightning Aura Component, Automate record creation using Apex triggers, Synchronize Salesforce data with an external system using asynchronous REST callouts, Test automation logic to confirm Apex trigger side effects, Test integration logic using callout mocks, Test scheduling logic to confirm action gets queued. oldRequestIds.add(req.Id); I have complete Idea of this coding bt I am not getting what to do before writing this code exactly for this challenge. }, PRIVATE STATIC Equipment_Maintenance_Item__c createWorkPart(id equipmentId,id requestId){ newCase.Vehicle__c=vehicleId; I find it really difficult to do anything on my own. @istest maintenanceNew.AccountId = acc.Id; Review the data schema in your modified Salesforce org as you read the detailed requirements below. Please update challenge 6 and all the respective things related to it. private static final string WORKING = Working; Concepts tested in this superbadge include: Apex Triggers . Map productMap = (Map) p; For any superbadge, you will have to install a package before starting. I had mine and wrote this while doing so, Free Salesforce Exam Coupon Codes for 2022. system.debug(EMIList +EMIList); Are you sure you want to create this branch? I'm working on the Apex Specialist super badge on the Salesforce Trailhead. Replace male USB-C plug in lenovo charger cable Is it possible to talk with "a staff"? Maintenance_Request__c = requestId); public static void updateWorkOrders(List caseList) { Showcase your mastery of business process automation without writing a line of code. Please find the link to telegram group on the homepage! 3 Answers. tmpCases.add(newCases.get(oldId)); Help with Superbadge Apex Specialist Step 3? Is it a bug? Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. lifespan_months__C = 10, So glad you cared to share this. for(Equipment_Maintenance_Item__c EMIRecord: EMIList){ return Vehicle; Do I need to do some prep work. Good luck to you all if you are working on this superbadge or preparing for the Salesforce Platform Developer II certification. Please create a seperate trailhead playground for each superbadge challenge. Stuck on Superbadge Apex Specialist Step 4? If it works its . FROM Equipment_Maintenance_Item__c where Maintenance_Request__r.ID in :caseKeys.keySet() Is that just automatically done behind the scenes? This query will return all completed batch, future, and queryable jobs that were completed today. Case newCase = buildCase(vehicle.Id,'Repair','DummyOK_'+i_ok); Subject=REQUEST_SUBJECT, I had posted these at the time i completed them. Are you sure you want to create this branch? update requestList; Set Up Development Org Share Improve this answer Follow For that, I would suggest the following udemy course: Salesforce Development Course. public static void setupTest(){ A tag already exists with the provided branch name. else{ newCase.Subject=subjectCase; insert newItems; if(vehicleToEquipmentMap.get(MRRecord.Vehicle__c)!=null){ Hi, newCase.Subject = 'Test Subject'; private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment’; global class WarehouseSyncSchedule implements Schedulable {, global void execute(SchedulableContext ctx) { You have to rename the two standard fields as indicated and then the mentioned changes in apex and trigger codes. caseIdSet.add(c.Id); // TODO: Complete the method to update workorders, public static void createNewMaintenanceRequest(Map oldMap, Map newMap){ If nothing happens, download Xcode and try again. Hot Network Questions Applications of super-mathematics to non-super mathematics Resistance against timing attacks of AES candidates How to deal with Hostile Work Environment after attending Employee Workshop The region and polygon don't match. newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ Now Update the below code in HelperClass MaintenanceRequestHelper, public static void updateWorkOrders(){// update workorders//bulk determineList maintenanceRequestList=[select id,case.Vehicle__c,Equipment__c,Equipment__r.Maintenance_Cycle__c,Type,Status from case where id in :Trigger.New limit 200];if(maintenanceRequestList !=null && maintenanceRequestList.size()>0 ){List insertMaintenanceRequest=getCaseList(maintenanceRequestList);insert insertMaintenanceRequest;}}, public static List getCaseList(List maintenanceRequestList){List newMaintenanceRequestList= new List();for(Case cas:maintenanceRequestList){if(cas.Type==Routine Maintenance && cas.Status==Closed){case newMaintenanceRequest=new Case();newMaintenanceRequest.Subject=test;newMaintenanceRequest.Type=Routine Maintenance;newMaintenanceRequest.Vehicle__c=cas.Vehicle__c;newMaintenanceRequest.Equipment__c=cas.Equipment__c;newMaintenanceRequest.Date_Reported__c=date.Today();newMaintenanceRequest.Date_Due__c=Date.today().addDays(Integer.valueOf(cas.Equipment__r.Maintenance_Cycle__c));newMaintenanceRequest.Status=New;newMaintenanceRequest.Origin=Phone;newMaintenanceRequestList.add(newMaintenanceRequest);}}return newMaintenanceRequestList;}}, 2: Synchronize Salesforce data with an external system, public with sharing class WarehouseCalloutService {. I have followed all your steps correctly, But Im still having this error every single time in 3rd challenge. List EquipmentIDListUpdate = new List(); If you don't see your @future method in the list, then there's something wrong, but if you . jaran@wezana.solutions, @isTest maintenanceNew.ContactId = contact.Id; ApexSchedulable , execute, Issue with Superbadge Apex Specialist Step 5? Create your own notes with your understanding and you can ask a senior at work to review them for you. Also some of the functions come predefined and it might be that as well. maintenanceNew.Vehicle__c = vehicle.Id; I just started Salesforce one and a half months ago. private static final string REQUEST_SUBJECT = Testing subject; PRIVATE STATIC Vehicle__c createVehicle(){ pr.Lifespan_Months__c = (Integer)productMap.get(lifespan) ; private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment; public void execute(QueueableContext context){ pr.Replacement_Part__c = (Boolean)productMap.get(replacement); private class WarehouseSyncScheduleTest { }. Use Git or checkout with SVN using the web URL. system.assertEquals(newReq.Type, REQUEST_TYPE); Equipment_Maintenance_Item__c i2 = buildItem(newCases[i_fail].Id, equipment.Id); test.stopTest(); list allRequest = [select id https://techevangel.com/2018/06/01/superbadge-advanced-apex-specialist/. Contact contact = [SELECT Id, FirstName, LastName,Email,AccountId FROM Contact WHERE Email = test@test.com LIMIT 1]; Modified 2 months ago. List newEMIRecordList = new List(); }. if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ and Schema Equipment_Maintenance_Item__c instead of Work_Part__c. } newEMIRecord.Quantity__c=EMIRecord.Quantity__c; Challenge 4: both negative and bulk run successfully but not positive test case. from Case newCases.put(oneCase.Id, newRoutineCase); for(Case caseInList: caseList){ caseToUpdate.add(newCase); private class MaintenanceRequestHelperTest {, @testSetup Stuck on Superbadge Apex Specialist Step 1? Salesforce Trailhead Superbadge: Apex Specialist Solution Challenge 1: Automate record creation STEP 1: Create a new Trailhead Playground Install the unmanaged Package Rename Case to Maintenance Request and Product to Equipment STEP 2: Automate record creation using Apex Trigger Update the trigger MaintenanceRequest: A place where magic is studied and practiced? for(Id idOld : idOldCases){ Vehicle__C vehicle = createVehicle(); 6. insert newEMIRecordList; Case newCase = new Case(); newItem.Maintenance_Request__c = caseId; For the first release, there are four Superbadges that you can earn: Apex Specialist I'm going to go into depth a little bit more about the Apex Specialist badge a little later on, but this one focuses heavily on apex customization via triggers, scheduled apex and apex callouts. for(Integer i_fail = 0; i_fail < 300; i_fail ++){ check if u have creted a process builder , i did create a proces builder and deactivated and it worked for me. }, insert listEquipmentMaintenanceItem; Connect and share knowledge within a single location that is structured and easy to search. This link helped me, so I modified the code like this: Thanks for contributing an answer to Stack Overflow! Thanks for letting know. Refresh the page, check. for(Integer i_ok = 0; i_ok < 300; i_ok ++){ Challenge 4 - MaintenanceHelperTest.class Could you please point out the specific line of the code where the function has been used for me to check and get back to you more quickly. maintenanceNew.Subject = 'Other'; Trailmixes. Challenge 2: Synchronize Salesforce data with an external system. Create an account to follow your favorite communities and start taking part in conversations. list vehicleList = new list(); @future Hey itachi, try debugging the code and look where the issue is. } insert contact; Vehicle__c vehicle = new Vehicle__c(); if(MRRecord.Status!= oldMap.get(MRRecord.ID).Status && MRRecord.Status == Closed && (MRRecord.Type==Repair || MRRecord.Type==Routine Maintenance)){ Hey nelson..Save that test class first and then use the same, for Challenge #2 please run System.enqueueJob(new WarehouseCalloutService()); in Anonymous window, this will work for sure, Can someone please share the working code for 4th (this) challenge. You must have 100% test coverage to pass this challenge and assert values to prove that your logic is working as expected. List emiList = new List(); Try logging in and out and reverify. , Super List newRoutineMaintenanceVehicleRecordIDList = new List(); newItem.Maintenance_Request__c = newCase.Id; listEquipmentMaintenanceItem.add(newItem); Challenge 3 - WarehouseSyncSchedule.class newItem.Quantity__c = item.Quantity__c; Staging Ground Beta 1 Recap, and Reviewers needed for Beta 2, What is wrong with my code on Trailhead challenge Developer Beginner > Apex Triggers > Bulk Apex Triggers, Apex Lightning upload fail because missing test class, How can I modify the meta data of any field using apex, How do i write test class for below apex code, Lightning Web Component Specialist Super badge: Challenge 7, Trailhead Superbadge Logic to create Junction Object, Apex Specialist Challenge 1 too Many DML Rows, Theoretically Correct vs Practical Notation. Also you could benefit more from some scenario based coding. Please Check this answer if this helps. Work fast with our official CLI. }, Hey sam! for(case req : requestList){ Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Challenge Not yet complete Here whats wrong: }. rev2023.3.3.43278. WHERE Maintenance_Request__c IN :setIdCases]; Map mapCases = new Map(); for(Integer i_fail = 0; i_fail < 300; i_fail ++){ Trailhead solution for Apex Specialist superbadge. Decimal maintenanceCycle = 0; public class Constants { public static final Integer DEFAULT_ROWS = 5; public static final String SELECT_ONE = Label.Select_One; public static final String INVENTORY_LEVEL_LOW = Label.Inventory_Level_Low; public static final List<Schema.PicklistEntry . 5 Comments on Apex Superbadge (part-1) Scenario:- Automate record creation. }. https://developer.salesforce.com/docs/atlas.ja-jp.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm, 3-8SOQLforTrigger.new100Trigger.new200(200200), for200 where Maintenance_Request__c in: oldRequestIds]; system.assert(allRequests.size() == 300); Superbadge will have some hints on what you are expected to do. } newCase.Subject=Routine Maintenance of Vehicle; Ask Question Asked 1 year, 3 months ago. I will look into it surely Thanks, Please leave a comment once you update the code, Could u specifically mention if one challenge has changed or entire superbadge set, Check the code mentioned by Laendor n lemme know if it works. Test callout logic } newCase.Date_Reported__c=Date.today(); where status =: STATUS_NEW]; list workParts = [select id , Greeting Laendor, Hope it helps, find it at the bottom of the website or search site name on telegram. for(Case MRRecord: newMap.values()){ This Superbadge is part of training/preparation for Platform Developer I Certification exam. newEMIRecord.Equipment__c=EMIRecord.Equipment__c; Change the CodesGo to Developer console and edit the Apex class and related triggers for below: Issue with Superbadge Apex Specialist Step 2? Vehicle__c Vehicle = new Vehicle__C(name = SuperTruck); vehicleList.add(createVehicle()); } System.assert(numberAllCases==900); Yeah, well make that someone yourself and do whatever the hell you want.. Try the same thing. insert emiListToBeUpdated; Please update challenge 6 as well as all the related material. (I have already renamed Case and Product objects) Apex Specialist Superbadge Trailmix | Salesforce Trailhead Laura Thomas +19,700 Points +1,000 points Module Apex Triggers Write Apex triggers to perform custom database actions. Product2 pr = new Product2(); Date todayDate = System.today(); This was my last superbadge and by completing thisAdvanced Apex Specialist Superbadge, I became eligible forPlatform Developer II certificate. EquipmentIDListUpdate.add(EMIRecord.Equipment__c); newCaseList.add(newCase); , Test.setMockMock +13,000 points ~12 hrs App Builder Super Set Superbadge Complete the capstone assessment to earn the App Builder Super Set. same error for me too.. can you please help me out, hi Please If you're if that type, you can read the apex developer documentation. else if(leastValueMap.containsKey(emi.Maintenance_Request__c) && emi.Equipment__r.Maintenance_Cycle__c < leastValueMap.get(emi.Maintenance_Request__c).Equipment__r.Maintenance_Cycle__c){ I am stuck in challenge 6. But i will surely get back to you on this. insert equipmentList; for(integer i = 0; i < 300; i++){ newMRRecord.Subject=Routine CheckUp + date.today(); MaintenanceRequestHelper.createNewEquipmentMaintenanceItem(Trigger.newMap); } } System.schedule , JobIdJobIDCronTriggerJob Does ZnSO4 + H2 at high pressure reverses to Zn + H2SO4? newMRRecord.Date_Reported__c=date.today(); This repository is for solving all the problems in the way of earning this superbadge. } Various trademarks held by their respective owners. Apex specialist superbadge challenge 4. id equipmentId = equipment.Id; System.debug(vehicleId+ +equipmentId); case somethingToUpdate = createMaintenanceRequest(vehicleId,equipmentId); newCase.Vehicle__c = c.Vehicle__c; } Alternatively you can join our telegram group for technical discussions among industry professionals, Hey komal. system.assert(newReq.Subject != null); if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ Apex Code Development (89731) General Development (54672) Visualforce Development (37117) Lightning (17463) APIs and Integration (16704) Trailhead (11575) Formulas & Validation Rules Discussion (11140) Other Salesforce Applications (7994) . It is nothing but the name of the class created earlier. if(Trigger.isBefore){ } We are always on the hunt for writers that have something interesting to say! Superbadge Apex Specialist Full Solutions 13 June 2020 by Nitin Raj Table of Contents Challenge 1: Automate record creation Challenge 2: Synchronize Salesforce data with an external system Challenge 3: Schedule synchronization Challenge 4: Test automation logic Challenge 5: Test callout logic Challenge 6: Test scheduling logic case cs = new case(Type=REPAIR, Superbadge Apex Specialist looks good on Resume, and they prove worth it as well. Hi, insert vehicleList; All rights reserved, Salesforce Advanced Apex Specialist Trailhead Superbadge, .. mark it public and tick the disable auto archive checkbox and use the description text given, TechForce Services Makes a Big Impact with its Cutting-Edge Solutions, Make sure you create the Custom metadata records with the exact same names given (that matches the product families), In the constants apex class, declare all the, OrderTrigger should use the Orderhelper internally for the rollup, in the pageblock table columns, use the field labels as headers using$ObjectType, update the column values to use the productRecord fields inside the productwrapper, use apex:chart to display the horizantal bar chart in a separate pageblock above the table, reRender the required components from the Save and Add buttons, Make the Controller class Without Sharing, replace the list of products with list of productwrapper, iterate thru the productWrapper and extract the products and pricebookentries and insert them separately, use try catch block and do a rollback if there are any errors, move the chart data initialisation logic to Chart Helper class, Make sure all the methods in the TestDataFactory class are, all the construct methods should create the mentioned objects with the required fields and unique names and return the records without inserting them. I am not able understand the issue, can you please help?? private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment'; // complete this method to make the callout (using @future) to the// REST endpoint and update equipment on hand. List caseToUpdate = new List(); for(Case newCase : [SELECT Id, Comments, Vehicle__c, Status FROM Case WHERE Subject LIKE DummyFAIL%]){ } newProducts.add(pr); I do know the core concepts but I am missing the connection. Is it a bug? https://takesurveyguide.com/safeway-customer-survey/. Try it. List newCaseList = new List(); insert tmpCases; public static Map getDueDate(List CaseIDs) { To learn more, see our tips on writing great answers.