if(MRRecord.Type==Routine Maintenance){ A tag already exists with the provided branch name. Challenge 4 - MaintenanceHelperTest.class Apex specialist superbadge challenge 4. MaintenanceRequestHelper.createNewEquipmentMaintenanceItem(Trigger.newMap); }, @isTest pr.Current_Inventory__c = (Integer)productMap.get(quantity); if((oneCase.status==closed) && (oneCase.type==Repair || oneCase.type==Routine Maintenance)) { }. newCases.add(newCase); Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Search for an answer or ask a question of the zone or Customer Support. newCaseList.add(newCase); newCase.Vehicle__c = c.Vehicle__c; } CronTrigger a=[SELECT Id FROM CronTrigger where NextFireTime > today]; System.assertEquals(jobID, a.Id,Schedule ); Originally published at https://shivshankarsfdc.com on July 29, 2019. Hey pratap! System.debug(*** Total cases (expected 900): +numberAllCases); Vehicle__C vehicle = createVehicle(); Create your own notes with your understanding and you can ask a senior at work to review them for you. 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) . @istest , Apex, ApexHttpCalloutMock It is nothing but the name of the class created earlier. } insert newCases; newItems = new List(); Date todayDate = System.today(); , Greeting Laendor, newCase.Origin=web; newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ } Share to someone in the Trailhead Community. Equipment_Maintenance_Item__c i1 = buildItem(newCases[i_ok].Id, equipment.Id); request.setEndpoint(WAREHOUSE_URL); Apex Specialist Challenge 1 too Many DML Rows. }, PRIVATE STATIC Product2 createEq(){ insert newMRRecordList; insert newEMIRecordList; There was a problem preparing your codespace, please try again. Is there a resource that I can go through that could help my understanding of apex broaden out and then attempt this superbadge. List newEMIRecordList = new List(); System.assert(numberAllCases==900); Its been long time I completed those quests. You must have 100% test coverage to pass this challenge and assert values to prove that your logic is working as expected. } } insert workP; test.startTest(); Test scheduling logic to confirm action gets queued. @future sign in if(maintenanceCycle>0) newEMIRecord.Quantity__c=EMIRecord.Quantity__c; Advanced-Apex-Specialist-Salesforce-Super-Badge. } System.debug(*** Total cases (expected 600): +numberAllCases); By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. }. You signed in with another tab or window. 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){ Case newCase = buildCase(vehicle.Id,'Electrical','DummyFAIL_'+i_fail); newItems.add(i1); Hope this helps!Looking For? If nothing happens, download GitHub Desktop and try again. for(Integer i_ok = 0; i_ok < 300; i_ok ++){ 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. where Maintenance_Request__c = :newReq.Id]; system.assert(workPart != null); cas.Type = 'Repair'; Hey Ms ! secondList.add(cas); tmpCases.add(newCases.get(oldId)); Trails. im geting error, Review the data schema in your modified Salesforce org as you read the detailed requirements below. } System.enqueueJob(New WarehouseCalloutService()); Hi Admin, following up on this comment. Concepts tested in this superbadge include: Apex Triggers . Maybe not optimized! I have followed all your steps correctly, But Im still having this error every single time in 3rd challenge. hi, martand please lemme know if it is verified, I ll update the same! I started working on this superbadge and this post is to document some of the findings / tips / gotchas as I progress through this one. public static void testPositive(){ Apex Specialist Superbadge Null Reference on Challenge 4. insert newCases; List newItems = new List(); pr.Name = (String)productMap.get(name); mapCases.get(oldCaseId).add(item); } Decimal maintenanceCycle = 0; Wait for a minute and run it twice maybe before checking challenges. Map caseKeys = new Map (CaseIDs); I would recommend you to follow the blog rather than looking into the code. The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie We've added a "Necessary cookies only" option to the cookie consent popup. private static final string REQUEST_TYPE = Routine Maintenance; , Super system.debug('leastValueMap '+leastValueMap); for(Case c : caseList){ leastValueMap.put(emi.Maintenance_Request__c,emi); Its a pretty long post that i wrote quiet long time back. product.Maintenance_Cycle__c = 2; newCase.Date_Reported__c = System.today(); for(Integer i_fail = 0; i_fail < 300; i_fail ++){ and Schema Equipment_Maintenance_Item__c instead of Work_Part__c. I am getting invalid type schema: for work_part__c, can you help me how to resolve this on, it doesnt seems typo error, but i cant find any field of such type also. Test.stopTest(); EquipmentIDListUpdate.add(EMIRecord.Equipment__c); Salesforce Interview Questions and Answers We Swear By! }, PRIVATE STATIC Equipment_Maintenance_Item__c createWorkPart(id equipmentId,id requestId){ Product2 pr = new Product2(); Use Git or checkout with SVN using the web URL. for(Case MRRecord: newMap.values()){ public static void updateWorkOrders(List caseList) { }, PRIVATE STATIC Case createMaintenanceRequest(id vehicleId, id equipmentId){ Hope it helps, find it at the bottom of the website or search site name on telegram. There can be technical errors n it might take more than one time to get it verified. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. public static String CRON_EXP = 0 0 0 15 3 ? Learn. Case newMRRecord = new Case(); insert product; maintenanceNew.Subject = 'Other'; 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: This repository is for solving all the problems in the way of earning this superbadge. Hi, Its giving error for me . SYSTEM.assertEquals(newReq.ProductId, equipmentId); vehicleToEquipmentMap.put(MRRecord.Vehicle__c,EquipmentIDListUpdate); pr.Replacement_Part__c = (Boolean)productMap.get(replacement); 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. private static final string REQUEST_ORIGIN = Web; 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. newCase.Subject=Routine Maintenance of Vehicle; Would have to get back to you. List emiListToBeUpdated = new List(); for(case c:caseList){ List createdCases = [Select Id from Case where Type = Routine Maintenance]; Hope this helps. If you don't get the complete picture of super badge, you can jot down the requirements and connect them(like a process flow diagram). use the Insert method to call all the construct methods and then insert the records returned from those methods. maintenanceNew.Date_Reported__c = Date.today(); Use integration and business logic to push your Apex coding skills to the limit with the Apex Specialist superbadge. } Apex I am unaware of any changes. newMRRecord.Date_Reported__c=date.today(); insert vehicle; for(Integer i_ok = 0; i_ok < 300; i_ok ++){ Actions to Earn This Superbadge Automate record creation using Apex triggers Product needs to be renamed as Equipment not Vehicle since Vehicle is already provided to us in the installed package. Map mapOldCasesWithItems = getItemsInOldCases(caseList); from case return equipment; The region and polygon don't match. Equipment_Maintenance_Item__c newEMIRecord = new Equipment_Maintenance_Item__c(); }, public static void updateNewMaintenanceRequest(List newList){ jaran@wezana.solutions, @isTest setIdCases.add(caseInList.Id); Vehicle__c vehicle = buildVehicle(); system.assert(newReq.Subject != null); } I am working on "Advanced Apex Specialist" Superbadge but I am not able to pass challenge 1 as it keeps on showing me that Select one label is not created. Almost every step has assistance posted on the Salesforce Developer and Trailblazers forums. Hope it helps. Honestly, I suggest reviewing the trailheads leading up to the apex super badge since the apex specialist Superbadge tests you on those core concepts. Home. I have Class name MaintenanceRequestHelper and i am adding it but still it not accepting this getting below error. contact.Email = test@test.com; for(Case caseInList: caseList){ 2UnixCron, Apex Thank you for this solution! Trailhead solution for Apex Specialist superbadge maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; to use Codespaces. Share Improve this answer Follow Use the included package content to . newMRRecord.Type=Routine Maintenance; Please Guide me.. Choose the Tab (orObject) you want torenameand clickEdit. caseToUpdate.add(newCase); rev2023.3.3.43278. private class MaintenanceRequestHelperTest {, @testSetup Salesforce[] [] [], REST API insert emptyReq; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId, emptyReq.Id); SELECT Id, Maintenance_Request__c, Equipment__c , Quantity__c Contact contact = [SELECT Id, FirstName, LastName,Email,AccountId FROM Contact WHERE Email = test@test.com LIMIT 1]; public static void setupTest(){ Start a discussion in the forum to get straight-up answers. }, Its not optimized but it gives me 500 points, and it is good! from case]; Equipment_Maintenance_Item__c workPart = [select id insert vehicle; return cs; newRoutineMaintenanceVehicleRecordIDList.add(MRRecord.Vehicle__c); Case newCase = buildCase(vehicle.Id,'Repair','DummyOK_'+i_ok); TimeZoneSidKey=America/Los_Angeles, UserName=stdtest@testorg.com); List caseList = new List(); 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. Hey itachi, try debugging the code and look where the issue is. A limit involving the quotient of two sums, Doubling the cube, field extensions and minimal polynoms, Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers), Euler: A baby on his lap, a cat on his back thats how he wrote his immortal works (origin?). }, Challenge 2 : Synchronize Salesforce data with an external system