Let the universe renounce some goodness to you . Is there a resource that I can go through that could help my understanding of apex broaden out and then attempt this superbadge. Step 1. Challenge 2: Synchronize Salesforce data with an external system. 6. The major problem that I have with superbadges is just understanding the question I have always known the input and output when I did programming. }. oldNewCaseMap.put(c.Id,newCase); Thanks for your wonderful gesture of letting know, I am also geating the same error . Trailhead List items = mapOldCasesWithItems.get(idOld); product.Replacement_Part__c = true; and Schema Equipment_Maintenance_Item__c instead of Work_Part__c. }, Its not optimized but it gives me 500 points, and it is good! }, @isTest } Vehicle__c newVehicle = new 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). TimeZoneSidKey=America/Los_Angeles, UserName=stdtest@testorg.com); List caseList = new List(); Salesforce Interview Questions and Answers We Swear By! Thanks for letting know. System.schedule , JobIdJobIDCronTriggerJob } maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; emiListToBeUpdated.add(e); newCase.Comments = New comment!; where status =: STATUS_NEW]; list workParts = [select id List emiList = new List(); I'm having a really hard time finishing this challenge. Trailhead solution for Apex Specialist superbadge How can we prove that the supernatural or paranormal doesn't exist? Salesforce Advanced Apex Specialist - Trailhead Superbadge where Maintenance_Request__c = :emptyReq.Id]; system.assert(workPart != null); } insert emiListToBeUpdated; 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. product.isActive = true; And i aint plan to do those again anytime sooner as well. Honestly, I suggest reviewing the trailheads leading up to the apex super badge since the apex specialist Superbadge tests you on those core concepts. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Hi Shaid, Please use below code:-. I highly doubt the entire quest would have changed. Here I have no idea what the input is nor what the output is supposed to be. Wait for a minute and run it twice maybe before checking challenges. EquipmentIDListUpdate.add(EMIRecord.Equipment__c); Maintenance_Request__c = requestId); newMRRecord.Type=Routine Maintenance; I would recommend you to follow the blog rather than looking into the code. admin List EquipmentIDListUpdate = 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. insert tmpCases; public static Map getDueDate(List CaseIDs) { 5 Comments on Apex Superbadge (part-1) Scenario:- Automate record creation. The followings are the challenges to earn this badge: Automate record creation using Apex triggers. With that being said, it seems like you need more understanding of the apex coding language in general. newMRRecordList.add(newMRRecord); 3 Answers. list oldRequestIds = new list(); for(integer i = 0; i < 300; i++){ salesforce Share Improve this question Follow Challenge 3 - WarehouseSyncSchedule.class Apex Specialist Superbadge. Automate record creation using Apex | by A tag already exists with the provided branch name. 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. All these codes are working 100% and run smoothly to help you achieve the below shiny badge. System.debug(*** Total cases (expected 600): +numberAllCases); Apex Specialist | Notes Collection Trailhead: Apex Specialist Superbadge Deadlypenguin Request you to please update Challenge 1. Continuing my quest with trailhead#SeizetheTrail , the last one in my list is theAdvanced Apex Specialist Superbadge. Contact contact = [SELECT Id, FirstName, LastName,Email,AccountId FROM Contact WHERE Email = test@test.com LIMIT 1]; request.setEndpoint(WAREHOUSE_URL); } Recovering from a blunder I made while emailing a professor. list vehicleList = new list(); Need help on specific errors? Challenge 6 - WarehouseSyncScheduleTest.class. 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. Reddit and its partners use cookies and similar technologies to provide you with a better experience. This repository is for solving all the problems and pass all the challenges in the way of earning this superbadge. This query will return all completed batch, future, and queryable jobs that were completed today. If it works its . Try the same thing. Challenge 2 - WarehouseCalloutService.class Apex Specialist. 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 {. Two Superbadges You Need to Be a Super Salesforce Developer newRoutineMaintenanceVehicleRecordIDList.add(MRRecord.Vehicle__c); newItems.add(i2); for(Case MRRecord: newList){ }. Build tests for your callout using the included class for the callout mock (WarehouseCalloutServiceMock) and callout test class (WarehouseCalloutServiceTest) in the package. Use integration and business logic to push your Apex coding skills to the limit with the Apex Specialist superbadge. Challenge Not yet complete heres whats wrong: And execute in the anonymous window below: Read More: Salesforce Interview Questions and Answers We Swear By! }, PRIVATE STATIC Product2 createEq(){ I had posted these at the time i completed them. id vehicleId = vehicle.Id; Product2 equipment = createEq(); }, insert listEquipmentMaintenanceItem; }. 1. What video game is Charlie playing in Poker Face S01E07? I'm also trying to get more comfortable with Visual Studio Code with the Salesforce extensions. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. private static final string REQUEST_TYPE = Routine Maintenance; HttpRequest request = new HttpRequest(); Connect and share knowledge within a single location that is structured and easy to search. 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. contact.Email = test@test.com; I worked through the Exam Prep guidelines. to use Codespaces. tmpCases.add(newCases.get(oldId)); Test callout logic List wpc= [ Unlock, Apex Specialist Super Badge If you have just one and a half months experience in Salesforce, apex specialist is a little too early now. GitHub - minicruiser/Apex-Specialist-Superbadge caseIdSet.add(c.Id); Work fast with our official CLI. Hi Admin, Please provide additional details in your answer. If multiple equipments are used in the maintenance request, choose the shortest maintenance cycle to define the service date. if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ And I might not be the best to advice on that particular section. Change the CodesGo to Developer console and edit the Apex class and related triggers for below: Issue with Superbadge Apex Specialist Step 2? SYSTEM.assertEquals(newReq.Vehicle__c, vehicleId); newEMIRecord.Quantity__c=EMIRecord.Quantity__c; Mock, product2 equipment = new product2(name = SuperEquipment, maintenanceNew.Vehicle__c = vehicle.Id; list requestList = new list(); Please lemme know if works. } List newRoutineMaintenanceVehicleRecordIDList = new List(); check the solution martland has linked, lemme know if it is working fin 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. Learn more. newCase.Date_Reported__c=Date.today(); Alternatively you can join our telegram group for technical discussions among industry professionals. if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ public static void setupTest(){ I do know the core concepts but I am missing the connection. Test.stopTest(); newEMIRecord.Equipment__c=EMIRecord.Equipment__c; Apex Specialist Superbadge. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. I will try and review that shortly and update the required. Apex Specialist Tips, Copyright 2000-2017 salesforce.com, inc.All rights reserved., Trailhead Reports & Dashboards Specialist, https://developer.salesforce.com/docs/atlas.ja-jp.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm, https://developer.salesforce.com/docs/atlas.ja-jp.apexcode.meta/apexcode/apex_scheduler.htm. newCase.Comments = New comment!; @istest 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. } Learn more. Advanced Apex Specialist Superbadge - Step 3 Issue . HttpResponse response = http.send(request); But I have created it as you can see in below image. My Blog explains about the steps for completing this super badge. Could you please point out the specifics. Status=STATUS_NEW, To learn more, see our tips on writing great answers. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Trigger.new, ApexHTTPHttpHttpRequestHttpResponse I hope you well.I know I should contact you but I just do not have anyone to turn to.Am stuck on challenge 4 for almost 3 weeks.Please help out. System.debug(*** Updated cases: +caseToUpdate.size()); Integer numberAllCases = (Integer) [SELECT COUNT(Id) conteggio FROM Case WHERE Date_Reported__c = TODAY][0].get(conteggio); How to react to a students panic attack in an oral exam? ApexSchedulable , execute, Laendor code is not working. Tips, ApexWeb APIApexDML1, Trigger.new sObject List Stuck on Superbadge Apex Specialist Step 6? insert somethingToUpdate; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId,somethingToUpdate.id); } Salesforce[] [] [], REST API Also some of the functions come predefined and it might be that as well. Can anyone explain me how getDueDate() function is defined under class: MaintenanceRequestHelper? Home. When this Superbadge came up, I identified several resources online that helped walk me through it. Salesforce Consultant || 6X Certified Salesforce || 1X DevOps Certified || TrailheadRanger || Salesforce Lover || Follow me at https://shivshankarsfdc.com/, 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. for(Equipment_Maintenance_Item__c emi : emiList){ pazhukh/Advanced-Apex-Specialist-Salesforce-Super-Badge @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(){.