insert product; Most of the other answers I found online also keep pointing to this Equipment__c field, which doesnt exist. test.stopTest(); list allRequests = [select id cas.Status = 'Closed'; }, insert listEquipmentMaintenanceItem; 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. Challenge 5 - WarehouseCalloutServiceMock.class and WarehouseCalloutServiceTest.class Hi the challenge has been updated. And I might not be the best to advice on that particular section. The major problem that I have with superbadges is just understanding the question I have always known the input and output when I did programming. advanced apex specialist superbadge solution Use the naming conventions specified in the requirements document to ensure a successful deployment. pr.Name = (String)productMap.get(name); insert equipmentList; for(integer i = 0; i < 300; i++){ newCase.Comments = New comment!; If you search regarding Apex on YouTube you'll find many more channels and videos. } TrailheadSalesforce newEMIRecord.Equipment__c=EMIRecord.Equipment__c; Showcase your mastery of business process automation without writing a line of code. We are always on the hunt for writers that have something interesting to say! List caseToUpdate = new List(); Please provide additional details in your answer. What am I doing wrong here in the PlotLegends specification? By accepting all cookies, you agree to our use of cookies to deliver and maintain our services and site, improve the quality of Reddit, personalize Reddit content and advertising, and measure the effectiveness of advertising. if(!newRoutineMaintenanceVehicleRecordIDList.contains(MRRecord.Vehicle__c)) Step 1 Go through the Apex Specialist Use-Case,Business Requirement And Schema Diagram of the Story, Step 2 -Create a New Trail Head Playground so That there will not be any Problem while Going through the apex code, Step 3 -To Start the apex challenge Install this unmanaged package after that go through the Standard object and the custom object details in your org so that you might get understand the basic of the Requirement, Step 4 you all have the apex class made while installing unmanaged package, a. Update the following below code in the MaintenanceRequest trigger, trigger MaintenanceRequest on Case (before update, after update) {, // call MaintenanceRequestHelper.updateWorkOrders. So even though you know the concepts you'll have to check and understand what fits where. Product2 equipment = buildEquipment(); 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 want to know that which part of my code is wrong, not just answer. // ToDo: Call MaintenanceRequestHelper.updateWorkOrders Press question mark to learn the rest of the keyboard shortcuts. leastValueMap.put(emi.Maintenance_Request__c,emi); if(MRRecord.Status!= oldMap.get(MRRecord.ID).Status && MRRecord.Status == Closed && (MRRecord.Type==Repair || MRRecord.Type==Routine Maintenance)){ It should work. } system.debug(EMIList +EMIList); 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 . ApexSchedulable , execute, Superbadges - Apex Specialist (The 'MaintenanceRequest' trigger does not appear to be handling bulk operations correctly) Hi guys, I'm almost finished with the test to get tge Apex Specialist SuperBadge, I attempt to validate the "Test automation logic" but I can't really see what is my error or why is not passing. Thanks for letting know. Decimal maintenanceCycle = 0; }. } Hi, Map mapOldCasesWithNewCases = createNewCases(caseList); linkEquipmentsToNewCases(mapOldCasesWithItems,mapOldCasesWithNewCases); Profile p = [SELECT Id FROM Profile WHERE Name=Standard User]; pr.Replacement_Part__c = (Boolean)productMap.get(replacement); Please note that I also have separate method to cover positive and negative scenarios. Step 2. } Please edit your answer to include an explanation of your code. where Maintenance_Request__c = :newReq.Id]; system.assert(workPart != null); Trailheads are good for general understanding of a concept whereas the super badge is a test of that concept in a scenario. Lightning Experience Specialist I had posted these at the time i completed them. MRRecord.Date_Due__c=MRRecord.Date_Due__c + integer.valueOf(maintenanceCycle); If multiple equipments are used in the maintenance request, choose the shortest maintenance cycle to define the service date. newCase.Date_Reported__c=Date.today(); insert newCases; List newItems = new List(); 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 {. new List(); Apex specialist superbadge challenge 4. }, PRIVATE STATIC Case createMaintenanceRequest(id vehicleId, id equipmentId){ system.debug('newCaseList '+newCaseList); Install the unmanaged package for the schema and stubs for Apex classes and triggers. All these codes are working 100% and run smoothly to help you achieve the below shiny badge. Create and follow custom learning playlists. I have Class name MaintenanceRequestHelper and i am adding it but still it not accepting this getting below error. Challenge 4 - MaintenanceHelperTest.class } List newCaseList = new List(); // Sync with Warehouse Use Git or checkout with SVN using the web URL. public static void testNegative(){ }. It's pretty comprehensive and contains several examples. But I have created it as you can see in below image. Hi Shaid, Please use below code:-. list requestList = new list(); 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. insert newCaseList; emiListToNewCase = [Select id,name,Maintenance_Request__c,Equipment__r.Maintenance_Cycle__c from Equipment_Maintenance_Item__c where Maintenance_Request__c IN: oldNewCaseMap.keySet()]; for(Equipment_Maintenance_Item__c emis : emiListToNewCase){ replacement_part__c = true); newCase.Date_Reported__c = System.today(); , Apex, ApexHttpCalloutMock contact.LastName = last; rev2023.3.3.43278. If you are facing any hurdles to complete the challenge, just go through the code. 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. SELECT Maintenance_Request__r.ID cID, MIN(Equipment__r.Maintenance_Cycle__c)cycle } If you don't see your @future method in the list, then there's something wrong, but if you . For that, I would suggest the following udemy course: Salesforce Development Course. Schedule synchronization | Apex Specialist | Salesforce wonder studies 5.77K subscribers Subscribe 241 Share Save 59K views 7 months ago Superbadge Apex Specialist PLEASE SUBSCRIBE IF YOU. hi, martand please lemme know if it is verified, I ll update the same! @future(callout=true)public static void runWarehouseEquipmentSync(){, if(response.getStatusCode()==200){//System.debug(size of equipment +equipmentlist.size());List updateEquipmentlist=getProductlist(response);if(updateEquipmentlist.size() > 0){insert new List(updateEquipmentlist);}}}, public static List getProductlist(HttpResponse response){, List