apex specialist superbadgeNosso Blog

apex specialist superbadgeriddick and kyra relationship

for(Id idOld : idOldCases){ @istest @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(){. Please Guide me.. I want to know that which part of my code is wrong, not just answer. Create your own notes with your understanding and you can ask a senior at work to review them for you. private static void testMaintenanceRequestBulk(){ Learn in-demand skills. newItem.Quantity__c = item.Quantity__c; public with sharing class WarehouseCalloutService implements queueable, Database.AllowsCallouts { Tips, ApexWeb APIApexDML1, Trigger.new sObject List Save my name, email, and website in this browser for the next time I comment. newItem.Quantity__c = 10; update secondList; if(!leastValueMap.containsKey(emi.Maintenance_Request__c)){ CronTrigger is similar to a cron job on UNIX systems. 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. // This object is available in API version 17.0 and later. insert vehicle; Product2 product = new Product2(); newMRRecord.Date_Due__c=date.today(); Hey sanskar! Apex specialist superbadge challenge 4. admin }, //public static void updateWorkOrders() { Create an account to follow your favorite communities and start taking part in conversations. upsert newProducts; Unlock, Apex Specialist Super Badge List listEquipmentMaintenanceItem = Equipment_Maintenance_Item__c i1 = buildItem(newCases[i_ok].Id, equipment.Id); https://takesurveyguide.com/safeway-customer-survey/. Hi, Career Paths. insert newCases; List newItems = new List(); contact.LastName = last; insert equipment; // ToDo: Call MaintenanceRequestHelper.updateWorkOrders for(Case newCase : [SELECT Id, Comments, Vehicle__c, Status FROM Case WHERE Subject LIKE DummyFAIL%]){ insert contact; Vehicle__c vehicle = new Vehicle__c(); I do know the core concepts but I am missing the connection. for(Case MRRecord: newList){ pr.Name = (String)productMap.get(name); Map newCases = new Map(); Copyright 2000-2022 Salesforce, Inc. All rights reserved. secondList.add(cas); Level Up with Salesforce and Win Free Certificate voucher! system.assert(allRequest.size() == 1); maintenanceNew.Date_Reported__c = Date.today(); Please update challenge 6 as well as all the related material. If you don't see your @future method in the list, then there's something wrong, but if you . Two Superbadges You Need to Be a Super Salesforce Developer maintenanceNew.Subject = 'Other'; TimeZoneSidKey=America/Los_Angeles, UserName=stdtest@testorg.com); List caseList = new List(); I worked through the Exam Prep guidelines. REST APIJSONJSONApex ObjectJSON, , VisualforceLightning ComponentApexApexApex if(MRRecord.Status!= oldMap.get(MRRecord.ID).Status && MRRecord.Status == Closed && (MRRecord.Type==Repair || MRRecord.Type==Routine Maintenance)){ Hey Nikhil. for(Integer i_fail = 0; i_fail < 300; i_fail ++){ Inserting a new Maintenance Request of type Routine Maintenance and then closing it did not create of a new Maintenance Request based upon the original record correctly. For any superbadge, you will have to install a package before starting. If you are facing any hurdles to complete the challenge, just go through the code. We are always on the hunt for writers that have something interesting to say! I am unaware of any changes. Skip to content. System.assert(numberAllCases==900); I have followed all your steps correctly, But Im still having this error every single time in 3rd challenge. List caseToUpdate = new List(); Thanks for letting know. 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 caseIdSet.add(c.Id); When this Superbadge came up, I identified several resources online that helped walk me through it. 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. How to react to a students panic attack in an oral exam? Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. private static final string STATUS_NEW = New; I find it really difficult to do anything on my own. Also some of the functions come predefined and it might be that as well. if(newProducts.size() >0) im stuck in challenge 4. Please note that I also have separate method to cover positive and negative scenarios. } if(newEMIRecordList.size()>0){ }, insert listEquipmentMaintenanceItem; Advanced-Apex-Specialist Showcase your mastery of business process automation without writing a line of code. private class MaintenanceRequestHelperTest {, @testSetup 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. from Case Map result = new Map(); Challenge 1 - MaintenanceRequest.trigger and MaintenanceRequestHelper.class Product2 newEquipment = new Product2(); Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. System.assert(numberAllCases==600); } Check the name of the apex class created and match it in same fashion. List EquipmentIDListUpdate = new List(); The challenge is expecting the due date to be calculated using the maintenance cycle defined on the related equipment records. if(vehicleToEquipmentMap.get(MRRecord.Vehicle__c)!=null){ Choose the Tab (orObject) you want torenameand clickEdit. vehicleToEquipmentMap.put(MRRecord.Vehicle__c,EquipmentIDListUpdate); } } Closing a Maintenance Request of type 'Routine Maintenance' or 'Repair' did not create of a new Maintenance Request with the correct due date. id equipmentId = equipment.Id; case emptyReq = createMaintenanceRequest(vehicleId,equipmentId); } Product2 equipment = buildEquipment(); List newRoutineMaintenanceVehicleRecordIDList = new List(); 3 Answers. Challenge Not yet complete heres whats wrong: Trailhead solution for Apex Specialist superbadge Start a discussion in the forum to get straight-up answers. } public static void updateWorkOrders(List caseList) { Apex Specialist Superbadge Null Reference on Challenge 4. where Maintenance_Request__c = :newReq.Id]; system.assert(workPart != null); newItems.add(i2); } salesforce - Advanced Apex Specialist - Please ensure that the Select Decimal maintenanceCycle = 0; } System.enqueueJob(New WarehouseCalloutService()); +13,000 points ~12 hrs App Builder Super Set Superbadge Complete the capstone assessment to earn the App Builder Super Set. Does ZnSO4 + H2 at high pressure reverses to Zn + H2SO4? leastValueMap.put(emi.Maintenance_Request__c,emi); Test.startTest(); Vehicle__c vehicle = createVehicle(); return result; Alternatively you can join our telegram group for technical discussions among industry professionals, Hey komal. pr.Cost__c = (Integer)productMap.get(cost); Any help appreciated! TrailheadSalesforce Subject=REQUEST_SUBJECT, system.debug('newCaseList '+newCaseList); Map productMap = (Map) p; for(Equipment_Maintenance_Item__c EMIRecord: EMIList){ caseToUpdate.add(newCase); Start a discussion in the forum to get straight-up answers. maintenanceNew.Type = 'Other'; same error for me too.. can you please help me out, hi }. newCase.Status=New; List wpc= [ Hey itachi, try debugging the code and look where the issue is. Status=STATUS_NEW, }. } You signed in with another tab or window. Hope this helps. ), Press J to jump to the feed. 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. Follow guided learning paths. ~2 hrs 15 mins +2,200 points Module Asynchronous Apex else{ 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) . Test.startTest(); Trailhead newEMIRecordList.add(newEMIRecord); Hey Ms ! SYSTEM.assertEquals(newReq.Date_Reported__c, system.today()); @istest } salesforce Share Improve this question Follow insert vehicle; Origin=REQUEST_ORIGIN, This Superbadge is part of training/preparation for Platform Developer I Certification exam. MaintenanceRequestTest.CreateData( 5,2,2,Repair); This link helped me, so I modified the code like this: Thanks for contributing an answer to Stack Overflow! Trailhead vol2. - Apex Specialist Tips enter image description here Tried creating another playground but still same issue. , Apex, ApexHttpCalloutMock Also various YouTube videos and blogs exist. @istest return equipment; where status =: STATUS_NEW]; list workParts = [select id This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Case newCase = buildCase(vehicle.Id,'Electrical','DummyFAIL_'+i_fail); Install the unmanaged package for the schema and stubs for Apex classes and triggers. 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. replacement_part__c = true); Map result = getDueDate(caseList); for(Case oneCase : caseList) { Refer to the Apex Specialist Superbadge: Trailhead Challenge Help document for detailed resources and documentation. } from Equipment_Maintenance_Item__c For Challenge 1 I am getting error for some of the fields that they doesnt exist like Vehicle__c, Equipment__c, Due_Date__c. private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment; public void execute(QueueableContext context){ Connect on telegram if you again face a similar issue, Hi jaffer. I will try and review that shortly and update the required. if(Trigger.isInsert){ private static Map createNewCases(List caseList) { private static final string REQUEST_TYPE = Routine Maintenance; request.setEndpoint(WAREHOUSE_URL); maintenanceNew.AccountId = acc.Id; Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); Vehicle__c newVehicle = new Vehicle__c(); 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){ } 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. This is an unofficial (no salesforce sponsorship) forum to discuss getting certified and building on salesforce platforms (force.com, heroku, exacttarget, slack, etc. Automate record creation using Apex | by Shiv Shankar | Medium Write Sign up Sign In 500 Apologies, but something went wrong on our end. Discover your ideal career. Closing a Maintenance Request of type Routine Maintenance did not create of a new . insert emiListToBeUpdated; and Schema Equipment_Maintenance_Item__c instead of Work_Part__c. Good luck to you all if you are working on this superbadge or preparing for the Salesforce Platform Developer II certification. 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. 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 {. Apex Specialist | Notes Collection

Commercial Letting Stroud, Why Do Football Boots Have Studs Pressure, Articles A



apex specialist superbadge

apex specialist superbadge