This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. public with sharing class MaintenanceRequestHelperTest {. if(!EquipmentIDListUpdate.contains(EMIRecord.Equipment__c)){ if(vehicleToEquipmentMap.get(MRRecord.Vehicle__c)!=null){ Test.startTest(); newCase.Subject=Routine Maintenance of Vehicle; I started working on this superbadge and this post is to document some of the findings / tips / gotchas as I progress through this one. Tips3, PlaygroundTrailhead Reports & Dashboards Specialist . Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Actions to Earn This Superbadge Automate record creation using Apex triggers insert newItems; newCase.Date_Reported__c=Date.today(); Create an account to follow your favorite communities and start taking part in conversations. Apex SpecialistApexMockApex Tips3 Playground Trailhead - Reports & Dashboards Specialist . } MaintenanceRequestTest.CreateData( 5,2,2,Repair); Id oldCaseId = item.Maintenance_Request__c; Thanks for your wonderful gesture of letting know, I am also geating the same error . newCases.add(newCase); CronTrigger is similar to a cron job on UNIX systems. insert product; emiList = [Select id,name,Maintenance_Request__c,Equipment__r.Maintenance_Cycle__c from Equipment_Maintenance_Item__c where Maintenance_Request__c IN: caseIdSet]; Map leastValueMap = new Map(); newCase.Type=Routine Maintenance; Challenge 4 - MaintenanceHelperTest.class SYSTEM.assertEquals(newReq.Date_Reported__c, system.today()); @istest } Learn directly from Salesforce experts. { , Greeting Laendor, upsert newProducts; 2022; static testmethod void testjob(){ Please Level Up with Salesforce and Win Free Certificate voucher! Hi, Challenge 1 - MaintenanceRequest.trigger and MaintenanceRequestHelper.class Work fast with our official CLI. 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 properties as public static. acc.Name = test; Connect on telegram if you again face a similar issue, Hi jaffer. 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 . for(Case MRRecord: newMap.values()){ } With that being said, it seems like you need more understanding of the apex coding language in general. Is there a specific import order? insert workPartList; test.startTest(); I would recommend you to follow the blog rather than looking into the code. Process Automation Specialist step 7 no work. //MaintenanceRequestHelper.createNewEquipmentMaintenanceItemList(Trigger.newMap); Any help appreciated! } Start a discussion in the forum to get straight-up answers. }, Hi, can anyone help me out with Challenge 4 in apex specialist? (I have already renamed Case and Product objects) pr.Maintenance_Cycle__c = (Integer)productMap.get(maintenanceperiod); Recovering from a blunder I made while emailing a professor. } 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. Challenge 2 - WarehouseCalloutService.class As bejng the solo running admin to this page i might not be able to update the solutions on short notice. insert equipment; 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. } Is there a proper earth ground point in this switch box? Challenge Not yet complete heres whats wrong: SYSTEM.assertEquals(newReq.ProductId, equipmentId); Case newCase = buildCase(vehicle.Id,'Repair','DummyOK_'+i_ok); somethingToUpdate.status = CLOSED; Hi, im geting error, system.debug('leastValueMap '+leastValueMap); for(Case c : caseList){ Vehicle__c newVehicle = new Vehicle__c(); salesforcedx-cli vs-code trailhead sfdx-plugin superbadges Chuck 805 asked Jan 22, 2021 at 0:05 6 votes 2 answers 5k views caseToUpdate.add(newCase); I create correct algoritm to find less maintenance cycle days. requestList.add(createMaintenanceRequest(vehicleList.get(i).id, equipmentList.get(i).id)); } Hey Ms ! } Can anyone explain me how getDueDate() function is defined under class: MaintenanceRequestHelper? Case newCase = new Case(); for(Case newCase : [SELECT Id, Comments, Vehicle__c, Status FROM Case WHERE Subject LIKE DummyOK%]){ Apex Specialist Superbadge Null Reference on Challenge 4. Build tests for your callout using the included class for the callout mock (WarehouseCalloutServiceMock) and callout test class (WarehouseCalloutServiceTest) in the package. insert equipment; List newCases = new List(); } This link helped me, so I modified the code like this: Thanks for contributing an answer to Stack Overflow! Use Git or checkout with SVN using the web URL. Test.stopTest(); 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. where Maintenance_Request__c in: oldRequestIds]; system.assert(allRequests.size() == 300); Method does not exist or incorrect signature: void CreateData(Integer, Integer, Integer, String) from the type MaintenanceRequestHelper. } if(Trigger.isBefore){ maintenanceNew.ContactId = contact.Id; System.assertEquals(1000,createdCases.size()); Need help for Challenge 4- can some one help me pls. Stuck on Superbadge Apex Specialist Step 1? for(Equipment_Maintenance_Item__c emi : emiList){ newCase.Type = 'Routine Maintenance'; caseToUpdate.add(newCase); Case newMRRecord = new Case(); pr.Current_Inventory__c = (Integer)productMap.get(quantity); https://techevangel.com/2018/06/01/superbadge-advanced-apex-specialist/. newEMIRecord.Equipment__c=EMIRecord.Equipment__c; Trailhead solution for Apex Specialist superbadge Challenge 1 - MaintenanceRequest.trigger and MaintenanceRequestHelper.class Challenge 2 - WarehouseCalloutService.class Challenge 3 - WarehouseSyncSchedule.class Challenge 4 - MaintenanceHelperTest.class Challenge 5 - WarehouseCalloutServiceMock.class and WarehouseCalloutServiceTest.class { from Equipment_Maintenance_Item__c new List(); Press question mark to learn the rest of the keyboard shortcuts. }, Its not optimized but it gives me 500 points, and it is good! @future, Http@futureAPI, @future callout true @future http.send Challenge 3 - WarehouseSyncSchedule.class which certification i should do to expertise myself in that domain, Hi there Neha ! leastValueMap.put(emi.Maintenance_Request__c,emi); } for(AggregateResult res :wpc){ And i aint plan to do those again anytime sooner as well. Hey itachi, try debugging the code and look where the issue is. List wpc= [ } }, Challenge 2 : Synchronize Salesforce data with an external system newCase.Subject=subjectCase; 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. 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. GitHub - minicruiser/Apex-Specialist-Superbadge minicruiser / Apex-Specialist-Superbadge Public Notifications 13 Star Code Issues main 1 branch 0 tags Go to file Code minicruiser Update MaintenanceRequestHelper.cls 8b195dd on Jun 6, 2022 14 commits step2 Automate record creation Update MaintenanceRequestHelper.cls 8 months ago } pr.Cost__c = (Integer)productMap.get(cost); Use Git or checkout with SVN using the web URL. Paste it below to help someone else looking. mukesh gupta. tmpCases.add(newCases.get(oldId)); Hi Shaid, Please use below code:-. Vehicle__c vehicle = [SELECT Id, Name FROM Vehicle__c WHERE Name = car LIMIT 1]; Apologies for the codes have changed. for this code: @isTest static void allTheDataForThisTestClass() {. Integer daysToAdd = Integer.valueOf(res.get(cycle)); This superbadges require a bit of practical experience in apex and all of them are not available on trailhead. MaintenanceRequestHelper.updateWorkOrders(); b. } insert emiListToBeUpdated; Hi Admin, following up on this comment. Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock()); return wp; A tag already exists with the provided branch name. maintenanceNew.Date_Reported__c = Date.today(); Thanks again for pointing it out. } Tips, ApexWeb APIApexDML1, Trigger.new sObject List newCase.Subject = 'Test Subject'; Case newCase = new Case(); hi niya system.assert(newReq.Subject != null); public static void setupTest(){ }, PRIVATE STATIC Equipment_Maintenance_Item__c createWorkPart(id equipmentId,id requestId){ where status =: STATUS_NEW]; list workParts = [select id im stuck in challenge 4. I used this code for MaintenanceRequestHelper: public with sharing class MaintenanceRequestHelper {. Change the labels for Case and Product To Maintenance Request and Equipment respectively. for(Case MRRecord: newList){ oldNewCaseMap.put(c.Id,newCase); if(!leastValueMap.containsKey(emi.Maintenance_Request__c)){ jaran@wezana.solutions, @isTest Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); Hi, Its giving error for me . insert newCases; List newItems = new List(); List newRoutineMaintenanceVehicleRecordIDList = new List(); }, @isTest static void test_triggerMaintenanceRequestHelperTest() {. for(Integer i_ok = 0; i_ok < 300; i_ok ++){ Please help me out, have you solved this if yes please help me, i have already used Queueable interface for WarehouseCalloutService class now i m stuck on step 5 with Test class WarehouseCalloutServiceTest , can you please help me with Test class code ,underlying is the Queueable interface code of WarehouseCalloutService class. Do lemme know if you find solutions codes that work well for it. request.setMethod(GET); Map mapOldCasesWithItems, Map mapOldCasesWithNewCases){. newCase.Vehicle__c = c.Vehicle__c; 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). Go to Setup > Apex Classes > Schedule a job like below: Edit the following in the Developer console. }, public static void updateNewMaintenanceRequest(List newList){ Closing a Maintenance Request of type Routine Maintenance did not create of a new . +2,000 points ~1 hr App Customization Specialist Superbadge 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){ hi, martand please lemme know if it is verified, I ll update the same! } @istest }, @istest insert tmpCases; public static Map getDueDate(List CaseIDs) { Modified 2 months ago. emiListToBeUpdated.add(e); Invalid type: Schema.Work_Part__c, Use variable as ProductId instaed of Equipment__c thanks! Hey Haja. Maintenance Request to the same vehicle . And I might not be the best to advice on that particular section. } ), Press J to jump to the feed. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. List newProducts = new List(); for(Object p : externalProducts) insert newCases; newItems = new List(); for(Integer i_ok = 0; i_ok < 300; i_ok ++){ list vehicleList = new list(); newEquipment.Maintenance_Cycle__c = 10; You signed in with another tab or window. }, Hey sam! Hi the challenge has been updated. Origin=REQUEST_ORIGIN, private static final string REPAIR = Repair; } Rename cases and products to match the HowWeRoll schema, and assign all profiles to the custom HowWeRoll page layouts for those objects. If you search regarding Apex on YouTube you'll find many more channels and videos. Udemy would be a paid platform, hence I'll suggest to first exhaust all the free resources and then jump on to Udemy courses. insert workP; test.startTest(); But I have created it as you can see in below image. List emiList = new List(); leastValueMap.put(emi.Maintenance_Request__c,emi); HttpRequest request = new HttpRequest(); @future contact.FirstName = test; Copy the name of the package and use this command in the terminal. } List EquipmentIDListUpdate = vehicleToEquipmentMap.get(MRRecord.Vehicle__c);