I started working on this superbadge and this post is to document some of the findings / tips / gotchas as I progress through this one. If you are facing any hurdles to complete the challenge, just go through the code. 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) . newMRRecordList.add(newMRRecord); if(res.get(cycle)!=null){ CronTrigger is similar to a cron job on UNIX systems. Vehicle__c vehicle = [SELECT Id, Name FROM Vehicle__c WHERE Name = car LIMIT 1]; System.enqueueJob(New WarehouseCalloutService()); }. I highly doubt the entire quest would have changed. Equipment_Maintenance_Item__c e = new Equipment_Maintenance_Item__c(); system.assert(newReq.Subject != null); maintenanceNew.ProductId = product.Id; There was a problem preparing your codespace, please try again. Please Guide me.. private static void testMaintenanceRequestPositive(){. I ll look into it and get back to you shortly. REST APIJSONJSONApex ObjectJSON, , VisualforceLightning ComponentApexApexApex private class MaintenanceRequestHelperTest {, @testSetup It should work. Vehicle__C vehicle = createVehicle(); insert vehicle; newCase.Comments = New comment!; List items = mapOldCasesWithItems.get(idOld); System.assertEquals(1000,createdCases.size()); Need help for Challenge 4- can some one help me pls. List emiListToNewCase = new List(); } upsert newProducts; Thanks again buddy. Schedule synchronization using Apex code. apex - Could not find a successfully completed @future job Use the included package content to . Wait for a minute and run it twice maybe before checking challenges. This link helped me, so I modified the code like this: Thanks for contributing an answer to Stack Overflow! vehicle.Name = car; Automate record creation | Apex Specialist | Salesforce If you have just one and a half months experience in Salesforce, apex specialist is a little too early now. Map newCases = new Map(); insert acc; Contact contact = new Contact(); newCase.Status=closed; SELECT Maintenance_Request__r.ID cID, MIN(Equipment__r.Maintenance_Cycle__c)cycle Recovering from a blunder I made while emailing a professor. insert newCases; newItems = new List(); Try the same thing. @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(){. Here is the code for bulk scenario testing which worked for me. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. contact.AccountId = acc.Id; for(Equipment_Maintenance_Item__c item : items){ A tag already exists with the provided branch name. newCase.Date_Due__c = todayDate.addDays(numberOfDays); Various trademarks held by their respective owners. Apex Specialist Superbadge Use integration and business logic to push your Apex coding skills to the limit. newRoutineMaintenanceVehicleRecordIDList.add(MRRecord.Vehicle__c); if(!leastValueMap.containsKey(emi.Maintenance_Request__c)){ You have to rename the two standard fields as indicated and then the mentioned changes in apex and trigger codes. Challenge 6 - WarehouseSyncScheduleTest.class. List EquipmentIDListUpdate = new List(); The WarehouseSyncSchedule apex class does not appear to be queuing a job for the WarehouseCalloutService class. Let the universe renounce some goodness to you . Any help appreciated! ProductId=equipmentId, Advanced Apex Specialist step 1 - Salesforce Developer Community newCases.add(newCase); { newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ salesforce Share Improve this question Follow Apex Specialist is one of the superbadges of Salesforce trailhead (A New Approach to Learning Salesforce) . if(Trigger.isInsert){ } +2,000 points ~1 hr App Customization Specialist Superbadge caseToUpdate.add(newCase); Hot Network Questions Would merfolk need beds? }. You must have 100% test coverage to pass this challenge and assert values to prove that your logic is working as expected. maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; insert vehicleList; Map mapOldCasesWithItems, Map mapOldCasesWithNewCases){. Method does not exist or incorrect signature: void CreateData(Integer, Integer, Integer, String) from the type MaintenanceRequestHelper. Case maintenanceNew = new Case(); Hi Niya. from case]; Equipment_Maintenance_Item__c workPart = [select id Map mapOldCasesWithNewCases = createNewCases(caseList); linkEquipmentsToNewCases(mapOldCasesWithItems,mapOldCasesWithNewCases); Test.startTest(); Create and follow custom learning playlists. 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. Equipment_Maintenance_Item__c i2 = buildItem(newCases[i_fail].Id, equipment.Id); newCase.Vehicle__c = c.Vehicle__c; Is there a specific import order? Hi @Edgar Moran, Can you please send me complete code of this "Unlock the Apex Specialist Superbadge". MaintenanceRequestHelper.createNewEquipmentMaintenanceItem(Trigger.newMap); It did not work for me. 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. Please help! List externalProducts = (List) JSON.deserializeUntyped(response.getBody()); im stuck in challenge 4. But I have created it as you can see in below image. Trigger.new, ApexHTTPHttpHttpRequestHttpResponse 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. Check the name of the apex class created and match it in same fashion. tmpCases.add(newCases.get(oldId)); Automate record creation using Apex | by Shiv Shankar | Medium Write Sign up Sign In 500 Apologies, but something went wrong on our end. Map vehicleToEquipmentMap = new Map(); Case newCase = new Case(); Good luck to you all if you are working on this superbadge or preparing for the Salesforce Platform Developer II certification. equipmentList.add(createEq()); } } Modify the Apex Classes as below, save and run all. Challenge Not yet complete Here whats wrong: Getting so many queries on this one I will surely try prioritize. Equipment_Maintenance_Item__c newEMIRecord = new Equipment_Maintenance_Item__c(); if(Trigger.isUpdate){ List lista = [ Apex SpecialistSuperbadge,Challenge-1 : Automate Record Creation,Challenge-2 : Synchronize Salesforce data with an external system. Apex Specialist. There was a problem preparing your codespace, please try again. } product.Maintenance_Cycle__c = 2; public with sharing class WarehouseCalloutService implements queueable, Database.AllowsCallouts {. Apologies for the codes have changed. Apex Specialist Superbadge Data Integration Specialist Superbadge Lightning Component Framework Specialist Superbadge PROJECT: Build a Conference Management App [3 hrs 40 mins] Lightning Experience Reports & Dashboards Specialist [4 - 6 hrs] takes the place of the "Reports & Dashboards Specialist" superbadge retired in 2017. } Origin=REQUEST_ORIGIN, If you like what I write and it has been ever helpful to you. }, insert listEquipmentMaintenanceItem; newCase.Type=typeCase; The followings are the challenges to earn this badge: Automate record creation using Apex triggers. insert workP; test.startTest(); 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. System.debug(*** Total cases (expected 900): +numberAllCases); public static void testNegative(){ List listEquipmentMaintenanceItem = Apex Specialist. Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. I will try and review that shortly and update the required. Hey Ms ! https://takesurveyguide.com/safeway-customer-survey/. So even though you know the concepts you'll have to check and understand what fits where. I have a background in programming but I just can't understand most of the challenge. for(Case caseInList: caseList){ Maybe not optimized! I'm having a really hard time finishing this challenge. I can fairly understand parts of it but never get the compete picture. newItem.Quantity__c = 10; Is there a resource that I can go through that could help my understanding of apex broaden out and then attempt this superbadge. Trailhead Academy. Maintenance_Request__c = requestId); It looks good on a resume to be a contributor. Superbadges | Salesforce Trailhead where Maintenance_Request__c in: oldRequestIds]; system.assert(allRequests.size() == 300); And i aint plan to do those again anytime sooner as well. Map result = new Map(); Maintenance Request to the same vehicle . If u further need help you can join the telegram group from link on the homepage. Alternatively you can join our telegram group for technical discussions among industry professionals. Copyright 2000-2022 Salesforce, Inc. All rights reserved. List newRoutineMaintenanceVehicleRecordIDList = new List(); } In that case the post hasnt been updated that much recently. hi niya 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). Career Paths. maintenanceNew.ContactId = contact.Id; 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){ MRRecord.Date_Due__c=MRRecord.Date_Due__c + integer.valueOf(maintenanceCycle); Hi the challenge has been updated. LocaleSidKey=en_US, ProfileId = p.Id, } Challenge 1 - MaintenanceRequest.trigger and MaintenanceRequestHelper.class } newMRRecord.Date_Reported__c=date.today(); insert newItems; newCases = new List(); acc.Name = test; newMRRecord.Type=Routine Maintenance; request.setEndpoint(WAREHOUSE_URL);

Eagle Telemedicine Jobs, Little House On The Prairie Spin Off Series, Is Barbara Mckay Still Married To Mike Mckay, Individual Dual And Team Sports Examples, Articles A

Comments

No comments.