Hi Admin, following up on this comment. Hi, trailhead.salesforce.com/en/content/learn/superbadges/superbadge_apex, Salesforce Trailhead Superbadge 'Apex Specialist', Synchronize Salesforce data with an external system using, Test automation logic to confirm Apex trigger side effects, Test scheduling logic to confirm action gets. Trailmixes. @istest }, private static Map getItemsInOldCases(List caseList){ Schedule synchronization using Apex code. ProductId=equipmentId, for(Integer i_ok = 0; i_ok < 300; i_ok ++){ 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. if(maintenanceCycle==0){ Need help on specific errors? 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. Asking for help, clarification, or responding to other answers. Salesforce Interview Questions and Answers We Swear By! Create your own notes with your understanding and you can ask a senior at work to review them for you. newCase.Comments = New comment!; mukesh gupta. Test.stopTest(); One question, how does the map newCases get updated with the new Case IDs following the insert tmpCases? private static final string CLOSED = Closed; I think you should focus on gaining more of hands on experiences in handling scenarios similar to those in health cloud domain. insert newEMIRecordList; Superbadge Process Automation Specialist Full Solutions. insert tmpCases; public static Map getDueDate(List CaseIDs) { insert newMRRecordList; GROUP BY Maintenance_Request__r.ID ]; It is nothing but the name of the class created earlier. from Equipment_Maintenance_Item__c }. Apex Specialist Superbadge Null Reference on Challenge 4. public static Vehicle__c buildVehicle(){ Best Answer chosen by Mohammad Shahid Shah. private static final string REQUEST_TYPE = Routine Maintenance; Tips3, PlaygroundTrailhead Reports & Dashboards Specialist . newCase.Origin=web; Save my name, email, and website in this browser for the next time I comment. EquipmentIDListUpdate.add(EMIRecord.Equipment__c); oldRequestIds.add(req.Id); }, Its not optimized but it gives me 500 points, and it is good! if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ Skip to content. Trailblazer CommunityTrailhead, ApexSalesforce Developer, Trailhead vol2. 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. maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; Vehicle__c vehicle = [SELECT Id, Name FROM Vehicle__c WHERE Name = car LIMIT 1]; Level Up with Salesforce and Win Free Certificate voucher! LWC Superbadge Step 3 - Setup / Clarification. Use integration and business logic to push your Apex coding skills to the limit with the Apex Specialist superbadge. User u = new User(Alias = stdtest, Email=stdtest@testorg.com, 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. Could you please point out the specifics. Trailhead solution for Apex Specialist superbadge Can anyone explain me how getDueDate() function is defined under class: MaintenanceRequestHelper? , Test.setMockMock new List(); Now, you'll have to map to what needs to done. If you are facing any hurdles to complete the challenge, just go through the code. newCase.Origin = 'Phone'; 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. Request you to please update Challenge 1. List secondList = new List(); Account acc = [SELECT Id, Name FROM Account WHERE Name = test LIMIT 1]; insert somethingToUpdate; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId,somethingToUpdate.id); Most of the other answers I found online also keep pointing to this Equipment__c field, which doesnt exist. Actions to Earn This Superbadge Automate record creation using Apex triggers Superbadge Process Automation Specialist Full Solutions. maintenanceNew.Subject = 'Other'; Case newCase = buildCase(vehicle.Id,'Electrical','DummyFAIL_'+i_fail); maintenanceNew.ContactId = contact.Id; Step 1. for(AggregateResult res :wpc){ Connect on telegram if you again face a similar issue, Hi jaffer. cas.Status = 'Closed'; 3 Answers. @isTest newMRRecord.Date_Reported__c=date.today(); Use the naming conventions specified in the requirements document to ensure a successful deployment. Hey pratap! I've successfully create a . By rejecting non-essential cookies, Reddit may still use certain cookies to ensure the proper functionality of our platform. This is the message I get: { But i will surely get back to you on this. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. admin ~1 hr 30 mins +1,500 points Module Apex Testing Write robust code by executing Apex unit tests. if(Trigger.isUpdate){ maintenance_cycle__C = 10, I'm also trying to get more comfortable with Visual Studio Code with the Salesforce extensions. newEMIRecordList.add(newEMIRecord); @isTest List newMRRecordList = new List(); newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ SYSTEM.assertEquals(newReq.ProductId, equipmentId); Laendor code is not working. vehicleToEquipmentMap.put(MRRecord.Vehicle__c,EquipmentIDListUpdate); ~2 hrs 15 mins +2,200 points Module Asynchronous Apex private static Map createNewCases(List caseList) { rev2023.3.3.43278. } Equipment_Maintenance_Item__c newEMIRecord = new Equipment_Maintenance_Item__c(); SYSTEM.assertEquals(newReq.Vehicle__c, vehicleId); Date newDate = Date.today(); if(result.get(oneCase.Id)!=null) { newItem.Quantity__c = item.Quantity__c; HttpResponse response = http.send(request); Please Check this answer if this helps. pr.Cost__c = (Integer)productMap.get(cost); https://techevangel.com/2018/06/01/superbadge-advanced-apex-specialist/. for(Id oldId : oldIdCases){ for(Case newCase : [SELECT Id, Comments, Vehicle__c, Status FROM Case WHERE Subject LIKE DummyFAIL%]){ } lifespan_months__C = 10, 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 . Start a discussion in the forum to get straight-up answers. Connect and share knowledge within a single location that is structured and easy to search. } 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 e.Equipment__c = emis.Equipment__c; from Equipment_Maintenance_Item__c if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ to use Codespaces. LocaleSidKey=en_US, ProfileId = p.Id, }. newItem.Maintenance_Request__c = newCase.Id; listEquipmentMaintenanceItem.add(newItem); Challenge 4: both negative and bulk run successfully but not positive test case. Advanced-Apex-Specialist-Salesforce-Super-Badge. maintenanceNew.Status = 'New'; So even though you know the concepts you'll have to check and understand what fits where. Reddit and its partners use cookies and similar technologies to provide you with a better experience. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Replace male USB-C plug in lenovo charger cable Is it possible to talk with "a staff"? Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. +2,000 points ~1 hr App Customization Specialist Superbadge Hope it helps, find it at the bottom of the website or search site name on telegram. Thank you for this solution! Is that just automatically done behind the scenes? List emiList = new List(); } to use Codespaces. }, PRIVATE STATIC Equipment_Maintenance_Item__c createWorkPart(id equipmentId,id requestId){ You signed in with another tab or window. System.assert(numberAllCases==900); list workPartList = new list(); I find it really difficult to do anything on my own. Test.stopTest(); I tried to use your code as it is and it gives error..For this superbadge I already read on 7th Dec that Superbadge challenge will be changed on 9th Dec and I am unaware about old superbadge so cant tell you what actual changes are. secondList.add(cas); 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. There was a problem preparing your codespace, please try again. If multiple equipments are used in the maintenance request, choose the shortest maintenance cycle to define the service date. You should definitely complete the task on your own and you can get all the help. insert equipment; private static final string WORKING = Working; }. Closing a Maintenance Request of type Routine Maintenance did not create of a new . There can be technical errors n it might take more than one time to get it verified. } acc.Name = test; Modify the Apex Classes as below, save and run all. Trailhead My Blog explains about the steps for completing this super badge. Salesforce, Trailhead, superbadge static void allTheDataForThisTestClass() {. please help. Is there a proper earth ground point in this switch box? Modified 2 months ago. } Start a discussion in the forum to get straight-up answers. { It should work. I'm having a really hard time finishing this challenge. } Invalid type: Schema.Work_Part__c, Use variable as ProductId instaed of Equipment__c insert emptyReq; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId, emptyReq.Id); Please } } Tips . Equipment_Maintenance_Item__c newEMIRecord = new Equipment_Maintenance_Item__c(); List newEMIRecordList = new List(); Trigger.new, ApexHTTPHttpHttpRequestHttpResponse test.stopTest(); list allRequests = [select id Also you could benefit more from some scenario based coding. pr.Name = (String)productMap.get(name); Is there a resource that I can go through that could help my understanding of apex broaden out and then attempt this superbadge. } EmailEncodingKey=UTF-8, LastName=Testing, LanguageLocaleKey=en_US, Change the CodesGo to Developer console and edit the Apex class and related triggers for below: Issue with Superbadge Apex Specialist Step 2? }, if(Trigger.isAfter){ } A tag already exists with the provided branch name. 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. } caseIdSet.add(c.Id); } and Schema Equipment_Maintenance_Item__c instead of Work_Part__c. //MaintenanceRequestHelper.createNewEquipmentMaintenanceItemList(Trigger.newMap); Getting so many queries on this one I will surely try prioritize. If you're if that type, you can read the apex developer documentation. System.assertEquals(1000,createdCases.size()); Need help for Challenge 4- can some one help me pls. Create and follow custom learning playlists. Integer numberOfDays = Integer.valueOf(leastValueMap.get(c.Id).Equipment__r.Maintenance_Cycle__c); Use the included package content to . Do lemme know if you find solutions codes that work well for it. newCase.Type=typeCase; } @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 externalEquipment = (List) JSON.deserializeUntyped(response.getBody());List equipmentlist=new List();//System.debug(size of result+externalEquipment.size());for (Object externalEquipment1: externalEquipment) {Map data = (Map)externalEquipment1;//system.debug(externalEquipment1);//system.debug(data+===+data.get(cost));Product2 equipment=new Product2();//equipment.Id =(String)data.get(_id);equipment.Cost__c=(Integer)data.get(cost);equipment.Lifespan_Months__c =(Integer)data.get(lifespan);equipment.Maintenance_Cycle__c =(Integer)data.get(maintenanceperiod);equipment.Name =(String)data.get(name);equipment.Current_Inventory__c =(Integer)data.get(quantity);equipment.Replacement_Part__c =(Boolean)data.get(replacement);equipment.Warehouse_SKU__c=(String)data.get(sku);equipmentlist.add(equipment);}return equipmentlist;}, public static HttpResponse getrespond(){Http http=new Http();HttpRequest request=new HttpRequest();request.setEndpoint(WAREHOUSE_URL);request.setMethod(GET);HttpResponse res=Http.send(request);return res;}}, global class WarehouseSyncSchedule implements Schedulable{// implement scheduled code hereglobal void execute (SchedulableContext sc){, WarehouseCalloutService.runWarehouseEquipmentSync();//optional this can be done by debug modeString sch = 00 00 01 * * ?;//on 1 pmSystem.schedule(WarehouseSyncScheduleTest, sch, new WarehouseSyncSchedule());}}, @isTestpublic class MaintenanceRequestTest {, @isTest static void testMaintenanceRequest(){, List maintenanceList=new List();List maintenanceListAfterClosed=new List();Vehicle__c vehicle=new Vehicle__c(Name=tata sumo,Air_Conditioner__c=true,Model__c=23Test);insert vehicle;Product2 equipment=new Product2(Name=tire,Cost__c=100,Current_Inventory__c =10,Replacement_Part__c=true,Warehouse_SKU__c =test,Lifespan_Months__c =10,Maintenance_Cycle__c=10);insert equipment;for(Integer i=1;i<=300;i++){Case maintenance=new Case(Subject=Test subject+i,Type=Routine Maintenance+i,Status=New+i,Origin=Phone+i,Equipment__c=equipment.Id,Vehicle__c=vehicle.Id);maintenanceList.add(maintenance);}insert maintenanceList;// system.assertEquals(300, maintenanceList.size());for(Case caseupdate:maintenanceList){caseupdate.Status=Closed;caseupdate.Type=Routine Maintenance;caseupdate.Date_Due__c=date.Today().addDays(Integer.valueOf(equipment.Maintenance_Cycle__c));maintenanceListAfterClosed.add(caseupdate);}Test.startTest();//UPDATE maintenanceListAfterClosed;//Bulk insert updateDatabase.SaveResult[] updatequipment = Database.update(maintenanceListAfterClosed);Test.stopTest();for(Database.SaveResult sa:updatequipment){System.assert(sa.isSuccess());}}}, @isTestglobal class WarehouseCalloutServiceMock implements HttpCalloutMock {// implement http mock callout//Mock responce created to test the call outglobal HttpResponse respond(HttpRequest request){System.assertEquals(https://th-superbadge-apex.herokuapp.com/equipment', request.getEndpoint());System.assertEquals(GET, request.getMethod());HttpResponse response = new HttpResponse();response.setHeader(Content-Type, application/json);response.setBody([{_id:55d66226726b611100aaf741,replacement:false,quantity:5,name:Generator 1000 kW,maintenanceperiod:365,lifespan:120,cost:5000,sku:100003}]);response.setStatusCode(200);return response;}}, @isTestprivate class WarehouseCalloutServiceTest {// implement your mock callout test here@isTest static void TestWarehouseCalloutService() {Test.startTest();//mock respoonseTest.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());WarehouseCalloutService.runWarehouseEquipmentSync();Test.stopTest();}}, @isTest static void WarehousescheduleTest(){.
Kate Kelly News Anchor, Articles A