list workPartList = new list(); List tmpCases = new List(); } maintenanceNew.Status = 'New'; 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 is the message I get: Challenge 5 - WarehouseCalloutServiceMock.class and WarehouseCalloutServiceTest.class newEMIRecord.Maintenance_Request__c=MRRecord.ID; I highly doubt the entire quest would have changed. 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 newProducts.add(pr); from Equipment_Maintenance_Item__c Please provide additional details in your answer. Go to Setup > Apex Classes > Schedule a job like below: Edit the following in the Developer console. LWC Superbadge Step 3 - Setup / Clarification. 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). addDays+=daysToAdd; caseToUpdate.add(newCase); Honestly, I suggest reviewing the trailheads leading up to the apex super badge since the apex specialist Superbadge tests you on those core concepts. newCase.Date_Reported__c=Date.today(); insert requestList; for(integer i = 0; i < 300; i++){ private static final string REPAIR = Repair; https://salesforce.quip.com/gJ3QAkFy6boE, Apex SpecialistApexMockApex }. Profile p = [SELECT Id FROM Profile WHERE Name=Standard User]; from Case By rejecting non-essential cookies, Reddit may still use certain cookies to ensure the proper functionality of our platform. @istest Trailhead, , (Super Badge) , Apex, ApexHttpCalloutMock maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; newDate = Date.today()+result.get(oneCase.Id); Test.startTest() Test.stopTest() , , startTeststopTest, A. Super BadgeUnlockTipsTrailheadTipsUnlock if(vehicleToEquipmentMap.get(MRRecord.Vehicle__c)!=null){ Apex @future List caseToUpdate = new List(); insert newCases; List newItems = new List(); if(Trigger.isInsert){ i wanted to excel myself in healthcloud domain of salesforce as i have started badges of that domain on trailhead if(MRRecord.Status!= oldMap.get(MRRecord.ID).Status && MRRecord.Status == Closed && (MRRecord.Type==Repair || MRRecord.Type==Routine Maintenance)){ LocaleSidKey=en_US, ProfileId = p.Id, If nothing happens, download Xcode and try again. It is nothing but the name of the class created earlier. insert newMRRecordList; System.assertEquals(1000,createdCases.size()); Need help for Challenge 4- can some one help me pls. $ sfdx force:source:retrieve -n NameOfThePackage This will retrieve all the components in the package into a new folder named as the package. }, PRIVATE STATIC Equipment_Maintenance_Item__c createWorkPart(id equipmentId,id requestId){ And execute in the anonymous window below: Read More: Salesforce Interview Questions and Answers We Swear By! replacement_part__c = true); Case newCase = new Case(); 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. I have a background in programming but I just can't understand most of the challenge. Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); Thanks I would go over this course. if(!newRoutineMaintenanceVehicleRecordIDList.contains(MRRecord.Vehicle__c)) Product2 product = [SELECT Id, Name, isActive, Maintenance_Cycle__c, Replacement_Part__c FROM Product2 WHERE Name = test LIMIT 1]; for(Integer i=1;i<=1000;i++){ , Super 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. Map result = getDueDate(caseList); for(Case oneCase : caseList) { newMRRecordList.add(newMRRecord); Create an account to follow your favorite communities and start taking part in conversations. Change the CodesGo to Developer console and edit the Apex class and related triggers for below: Issue with Superbadge Apex Specialist Step 2? Thanks again buddy. Set oldIdCases = newCases.keySet(); insert vehicle; Product2 product = new Product2(); newCase.Equipment__c = leastValueMap.get(c.Id).Equipment__c; Use above code for step 5 and then use system assert with constant 0 and returned value will be 0. List createdCases = [Select Id from Case where Type = Routine Maintenance]; For the most part everything else is pretty straightforward and this helped me get my 500 points. Hey harsh. newCase.Vehicle__c=vehicleId; , Greeting Laendor, }. Eigenmann & Veronelli un Gruppo internazionale che nasce nel 1910 leader nella distribuzione di specialit chimiche e ingredienti alimentari per l'industria.. Con circa 340 dipendenti e . 1. I would recommend you to follow the blog rather than looking into the code. Step 1. maintenanceNew.Vehicle__c = vehicle.Id; thanks! for(Equipment_Maintenance_Item__c item : items){ } Please You signed in with another tab or window. contact.AccountId = acc.Id; Share Improve this answer Follow for(Id idOld : idOldCases){ newCase.Origin=web; My Blog explains about the steps for completing this super badge. where status =: STATUS_NEW]; list workParts = [select id oldNewCaseMap.put(c.Id,newCase); private static void testMaintenanceRequestBulk(){ Showcase your mastery of business process automation without writing a line of code. If you like what I write and it has been ever helpful to you. With that being said, it seems like you need more understanding of the apex coding language in general. 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 . } }, Case newRoutineCase = createNewMaintenanceCase(oneCase.Id, oneCase.Vehicle__c, newDate); Viewed 5k times . If you are facing any hurdles to complete the challenge, just go through the code. emiList = [Select id,name,Maintenance_Request__c,Equipment__r.Maintenance_Cycle__c from Equipment_Maintenance_Item__c where Maintenance_Request__c IN: caseIdSet]; Map leastValueMap = new Map(); for(Case MRRecord: newMap.values()){ Wait for a minute and run it twice maybe before checking challenges. Apex Specialist. id equipmentId = equipment.Id; case emptyReq = createMaintenanceRequest(vehicleId,equipmentId); And I might not be the best to advice on that particular section. newCases.put(oneCase.Id, newRoutineCase); }. }. rev2023.3.3.43278. }, Hi, can anyone help me out with Challenge 4 in apex specialist? for(Case caseInList: caseList){ update caseToUpdate; Trailmixes. } Accelerate learning across your organization. } insert vehicle; I started working on this superbadge and this post is to document some of the findings / tips / gotchas as I progress through this one. Share to someone in the Trailhead Community. What video game is Charlie playing in Poker Face S01E07? product.Name = test; Superbadge Apex Specialist Full Solutions 13 June 2020 by Nitin Raj Table of Contents Challenge 1: Automate record creation Challenge 2: Synchronize Salesforce data with an external system Challenge 3: Schedule synchronization Challenge 4: Test automation logic Challenge 5: Test callout logic Challenge 6: Test scheduling logic Does ZnSO4 + H2 at high pressure reverses to Zn + H2SO4? Decimal maintenanceCycle = 0; Challenge Not yet complete Here whats wrong: }. Any help appreciated! if(MRRecord.Type==Routine Maintenance){ contact.LastName = last; Hi Admin, if(maintenanceCycle==0){ +2,000 points ~1 hr App Customization Specialist Superbadge Case newCase = new Case(); Hey Nikhil. insert workP; test.startTest(); public static void testPositive(){ maintenanceNew.Subject = 'Other'; mapCases.get(oldCaseId).add(item); contact.FirstName = test; newItems.add(i1); Could you please point out the specific line of the code where the function has been used for me to check and get back to you more quickly. How Intuit democratizes AI development across teams through reusability. Test scheduling logic to confirm action gets queued. setIdCases.add(caseInList.Id); } }. Hey sanskar! public with sharing class WarehouseCalloutService implements queueable, Database.AllowsCallouts { Trailhead Academy. im stuck in challenge 4. ~2 hrs 15 mins +2,200 points Module Asynchronous Apex For that, I would suggest the following udemy course: Salesforce Development Course. private static final string CLOSED = Closed; Challenge 3 - WarehouseSyncSchedule.class return cs; REST APIJSONJSONApex ObjectJSON, , VisualforceLightning ComponentApexApexApex Map mapOldCasesWithNewCases = createNewCases(caseList); linkEquipmentsToNewCases(mapOldCasesWithItems,mapOldCasesWithNewCases); Can anyone explain me how getDueDate() function is defined under class: MaintenanceRequestHelper? insert newItems; newCases = new List(); static void allTheDataForThisTestClass() {. update somethingToUpdate; Case newReq = [Select id, subject, type, Date_Reported__c, Vehicle__c, Date_Due__c ChangethelabelsforStandard Objectsand Fields in SalesforceGo to Setup -> Customize -> Tab Names andLabels->RenameTabs andLabels. Its been long time I completed those quests. } // TODO: Complete the method to update workorders, public static void createNewMaintenanceRequest(Map oldMap, Map newMap){ 0. 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) . for(Equipment_Maintenance_Item__c EMIRecord: EMIList){ Stuck on Superbadge Apex Specialist Step 4? To subscribe to this RSS feed, copy and paste this URL into your RSS reader. result.put((Id)res.get(cID),addDays); Use Git or checkout with SVN using the web URL. I have Class name MaintenanceRequestHelper and i am adding it but still it not accepting this getting below error. Start a discussion in the forum to get straight-up answers. To learn more, see our tips on writing great answers. cas.Status = 'Closed'; EquipmentIDListUpdate.add(EMIRecord.Equipment__c); Skip to content. Is it a bug? newCase.Origin=web; SELECT Id, Maintenance_Request__c, Equipment__c , Quantity__c But I have created it as you can see in below image. Set idOldCases = mapOldCasesWithNewCases.keySet(); APEX. if(newEMIRecordList.size()>0){ lifespan_months__C = 10, Map caseKeys = new Map (CaseIDs); I think you should focus on gaining more of hands on experiences in handling scenarios similar to those in health cloud domain. somethingToUpdate.status = CLOSED; newEMIRecord.Equipment__c=EMIRecord.Equipment__c; newCase.Type=typeCase; Apex Specialist Superbadge Null Reference on Challenge 4. Vehicle__c newVehicle = new Vehicle__c(); Refresh the page, check. for(Case MRRecord: newMap.values()){ Origin=REQUEST_ORIGIN, newItem.Maintenance_Request__c = newCase.Id; listEquipmentMaintenanceItem.add(newItem); I've successfully create a . maintenanceNew.Date_Reported__c = Date.today(); where status = :STATUS_NEW]; Equipment_Maintenance_Item__c workPart = [select id I find it really difficult to do anything on my own. EmailEncodingKey=UTF-8, LastName=Testing, LanguageLocaleKey=en_US, REST APICall insert emptyReq; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId, emptyReq.Id); Is there a specific import order? 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. Hey itachi, try debugging the code and look where the issue is. Lets grow together. If you don't see your @future method in the list, then there's something wrong, but if you . system.debug(EMIList +EMIList); public with sharing class MaintenanceRequestHelperTest {. A tag already exists with the provided branch name. Challenge 4: both negative and bulk run successfully but not positive test case. }, @isTest 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 {. private static final string WORKING = Working; I have followed all your steps correctly, But Im still having this error every single time in 3rd challenge. Actions to Earn This Superbadge Automate record creation using Apex triggers private static final string REQUEST_SUBJECT = Testing subject; PRIVATE STATIC Vehicle__c createVehicle(){ } Change the labels for Case and Product To Maintenance Request and Equipment respectively. Best Answer chosen by Mohammad Shahid Shah. Modifications to the below Apex Classes as below. Closing a Maintenance Request of type Routine Maintenance did not create of a new . This was my last superbadge and by completing thisAdvanced Apex Specialist Superbadge, I became eligible forPlatform Developer II certificate. public static void setupTest(){ Alternatively you can join our telegram group for technical discussions among industry professionals, Hey komal. } Http http = new Http(); Please help! Hi Admin, following up on this comment. Product2 equipment = buildEquipment(); Work fast with our official CLI. Product2 pr = new Product2(); I think everyone has given awesome suggestions , I'll try to add some more insights -. Create and follow custom learning playlists. newCases.add(newCase); MaintenanceRequestHelper.createNewMaintenanceRequest(Trigger.oldMap,Trigger.newMap); Map newCases = new Map(); for(AggregateResult res :wpc){ test.stopTest(); list allRequests = [select id } newEMIRecord.Maintenance_Request__c=MRRecord.ID; , @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(){.
Shooting In Berwyn Il Last Night, Adria Spare Parts Catalogue, Cris Crash Agency Login, Lauren Caldwell Engaged, 380 Rifle Lever Action, Articles A