update somethingToUpdate; Case newReq = [Select id, subject, type, Date_Reported__c, Vehicle__c, Date_Due__c Could you please point out the specifics. Map productMap = (Map) p; I'm having a really hard time finishing this challenge. Please lemme know if works. newCase.Date_Reported__c=Date.today(); } But i will surely get back to you on this. Salesforce[] [] [], REST API For that, I would suggest the following udemy course: Salesforce Development Course. // TODO: Complete the method to update workorders, public static void createNewMaintenanceRequest(Map oldMap, Map newMap){ }, if(Trigger.isAfter){ Is it a bug? Issue with Superbadge Apex Specialist Step 5? newCase.Date_Reported__c=Date.today(); if (!mapCases.containsKey(oldCaseId)){ list workPartList = new list(); HttpResponse response = http.send(request); Challenge 4: both negative and bulk run successfully but not positive test case. Stuck on Superbadge Apex Specialist Step 1? } insert equipment; List newCases = new List(); You must have 100% test coverage to pass this challenge and assert values to prove that your logic is working as expected. if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ Rename cases and products to match the HowWeRoll schema, and assign all profiles to the custom HowWeRoll page layouts for those objects. } caseIdSet.add(c.Id); Change the labels for Case and Product To Maintenance Request and Equipment respectively. else if(maintenanceCycle > EMIRecord.Equipment__r.Maintenance_Cycle__c){ }, PRIVATE STATIC Product2 createEq(){ } This Superbadge is part of training/preparation for Platform Developer I Certification exam. String joBID= System.schedule(TestScheduleJob, CRON_EXP, new WarehouseSyncSchedule()); id vehicleId = vehicle.Id; Product2 equipment = createEq(); newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ update emptyReq; private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment; public void execute(QueueableContext context){ List emiListToNewCase = new List(); Code shared by Laendor is not working. newCase.Subject=Routine Maintenance of Vehicle; rev2023.3.3.43278. } SYSTEM.assertEquals(newReq.ProductId, equipmentId); Try the same thing. Case newCase = buildCase(vehicle.Id,'Electrical','DummyFAIL_'+i_fail); 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. } insert newItems; newCases = new List(); Learn. I have complete Idea of this coding bt I am not getting what to do before writing this code exactly for this challenge. List EMIList = new List([SELECT Maintenance_Request__c,Maintenance_Request__r.Vehicle__c,Equipment__c, Equipment__r.Maintenance_Cycle__c,Quantity__c FROM Equipment_Maintenance_Item__c WHERE Maintenance_Request__r.Vehicle__c IN: newRoutineMaintenanceVehicleRecordIDList]); Apex Specialist Superbadge Use integration and business logic to push your Apex coding skills to the limit. Asking for help, clarification, or responding to other answers. Here I have no idea what the input is nor what the output is supposed to be. Salesforce List newRoutineMaintenanceVehicleRecordIDList = new List(); I have a background in programming but I just can't understand most of the challenge. Learn in-demand skills. Thank you for this solution! ( Automate record creation ), I face this error what can I do please Help me. Origin=REQUEST_ORIGIN, You signed in with another tab or window. The author also has a YouTube channel that goes over key concepts which may be helpful: SFDC YouTube Channel Best of luck! Trailblazer CommunityTrailhead, ApexSalesforce Developer, Trailhead vol2. 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. return cs; Id oldCaseId = item.Maintenance_Request__c; Hot Network Questions where Maintenance_Request__c in: oldRequestIds]; system.assert(allRequests.size() == 300); Challenge 2: Synchronize Salesforce data with an external system. List listEquipmentMaintenanceItem = product.Maintenance_Cycle__c = 2; private static final string REPAIR = Repair; As bejng the solo running admin to this page i might not be able to update the solutions on short notice. }. Wait for a minute and run it twice maybe before checking challenges. https://techevangel.com/2018/06/01/superbadge-advanced-apex-specialist/. }. HttpRequest request = new HttpRequest(); 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. for(Equipment_Maintenance_Item__c item: lista){ Also some of the functions come predefined and it might be that as well. Apex I ll look into it and get back to you shortly. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. } Refer to the Apex Specialist Superbadge: Trailhead Challenge Help document for detailed resources and documentation. Map mapOldCasesWithItems, Map mapOldCasesWithNewCases){. Challenge Not yet complete heres whats wrong: By rejecting non-essential cookies, Reddit may still use certain cookies to ensure the proper functionality of our platform. Hi, mukesh gupta. Apex specialist superbadge challenge 4. setIdCases.add(caseInList.Id); Discover your ideal career. It should work. I'm working on the Apex Specialist super badge on the Salesforce Trailhead. newCase.Subject=subjectCase; Equipment_Maintenance_Item__c wp = new Equipment_Maintenance_Item__c(Equipment__c = equipmentId, { The followings are the challenges to earn this badge: Automate record creation using Apex triggers. maintenanceNew.Vehicle__c = vehicle.Id; } }. The region and polygon don't match. emptyReq.Status = WORKING; 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 {. (I have already renamed Case and Product objects) public static void testNegative(){ newMRRecord.Date_Due__c=date.today(); } }, public static void createNewEquipmentMaintenanceItem(Map newMap){ newCaseList.add(newCase); public with sharing class MaintenanceRequestHelperTest {. }, //public static void updateWorkOrders() { static private Case createNewMaintenanceCase(Id oldCaseId,Id vehicle, Date newDate) { for(Id idOld : idOldCases){ Invalid type: Schema.Work_Part__c, Use variable as ProductId instaed of Equipment__c I had cleared this superbadge way back in time would have to seriously redo it to understand what was done on this one. Equipment_Maintenance_Item__c newEMIRecord = new Equipment_Maintenance_Item__c(); Trailhead, , (Super Badge) equipmentList.add(createEq()); Share Improve this answer Follow So glad you cared to share this. Tips3, PlaygroundTrailhead Reports & Dashboards Specialist . } If nothing happens, download GitHub Desktop and try again. Do lemme know if you find solutions codes that work well for it. private static final string CLOSED = Closed; }. Trailmixes. Making statements based on opinion; back them up with references or personal experience. Getting so many queries on this one I will surely try prioritize. Salesforce Interview Questions and Answers We Swear By! //MaintenanceRequestHelper.createNewEquipmentMaintenanceItemList(Trigger.newMap); } This is the message I get: MRRecord.Date_Due__c=MRRecord.Date_Due__c + integer.valueOf(maintenanceCycle); The challenge is expecting the due date to be calculated using the maintenance cycle defined on the related equipment records. e.Equipment__c = emis.Equipment__c; So even though you know the concepts you'll have to check and understand what fits where. insert equipment; This repository is for solving all the problems and pass all the challenges in the way of earning this superbadge. Hot Network Questions Would merfolk need beds? Synchronize Salesforce data with an external system using asynchronous REST callouts. Status=STATUS_NEW, We are always on the hunt for writers that have something interesting to say! return equipment; 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. Advanced Apex Specialist Superbadge - Step 3 Issue . pr.Cost__c = (Integer)productMap.get(cost); private static final String WAREHOUSE_URL = https://th-superbadge-apex.herokuapp.com/equipment'; // complete this method to make the callout (using @future) to the// REST endpoint and update equipment on hand. I started working on this superbadge and this post is to document some of the findings / tips / gotchas as I progress through this one. }, @isTest newCase.Date_Due__c = todayDate.addDays(numberOfDays); for(case req : requestList){ MaintenanceRequestHelper.updateWorkOrders(); b. Case newMRRecord = new Case(); By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); }. 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). insert vehicle; if(c.Type == 'Repair' || c.Type == 'Routine Maintenance'){ Account acc = new Account(); if(Trigger.isInsert){ } Can you please help me out, I am also getting the same error. for(Case MRRecord: newList){ pr.Current_Inventory__c = (Integer)productMap.get(quantity); A limit involving the quotient of two sums, Doubling the cube, field extensions and minimal polynoms, Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers), Euler: A baby on his lap, a cat on his back thats how he wrote his immortal works (origin?). List newRoutineMaintenanceVehicleRecordIDList = new List(); Modifications to the below Apex Classes as below. Date todayDate = System.today(); Try logging in and out and reverify. workPartList.add(createWorkPart(equipmentList.get(i).id, requestList.get(i).id)); I have access to udemy too so could someone mention a course or something. I would recommend you to follow the blog rather than looking into the code. } } Apologies for m caught quite off guard at this moment. } for(Equipment_Maintenance_Item__c emi : emiList){ @future Hi Niya. List newEMIRecordList = new List(); I will try and review that shortly and update the required. return Vehicle; Hey Haja. 5 Comments on Apex Superbadge (part-1) Scenario:- Automate record creation. maintenanceNew.Subject = 'Other'; Hey harsh. Case newCase = new Case(); }. thanks! request.setEndpoint(WAREHOUSE_URL); vehicle.Name = car; Copyright 2000-2022 Salesforce, Inc. All rights reserved. private static final string REQUEST_TYPE = Routine Maintenance; ApexSOQL100, Apex This query will return all completed batch, future, and queryable jobs that were completed today. Check the name of the apex class created and match it in same fashion. MaintenanceRequestHelper.createNewEquipmentMaintenanceItem(Trigger.newMap); 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 . I've successfully create a . Is there a specific import order? What video game is Charlie playing in Poker Face S01E07? Modify the Apex Classes as below, save and run all. List newCaseList = new List(); I worked through the Exam Prep guidelines. I used this code for MaintenanceRequestHelper: public with sharing class MaintenanceRequestHelper {. 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. from case]; Equipment_Maintenance_Item__c workPart = [select id 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. This was my last superbadge and by completing thisAdvanced Apex Specialist Superbadge, I became eligible forPlatform Developer II certificate. pr.Maintenance_Cycle__c = (Integer)productMap.get(maintenanceperiod); } }, PRIVATE STATIC Equipment_Maintenance_Item__c createWorkPart(id equipmentId,id requestId){ 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. Lightning Experience Specialist from Case Is that just automatically done behind the scenes? Thanks for letting know. Apologies for the codes have changed. newEMIRecordList.add(newEMIRecord); ~1 hr 30 mins +1,500 points Module Apex Testing Write robust code by executing Apex unit tests. vehicleToEquipmentMap.put(MRRecord.Vehicle__c,EquipmentIDListUpdate); Good luck to you all if you are working on this superbadge or preparing for the Salesforce Platform Developer II certification. Please Closing a Maintenance Request of type Routine Maintenance did not create of a new . Apex @future Staging Ground Beta 1 Recap, and Reviewers needed for Beta 2, What is wrong with my code on Trailhead challenge Developer Beginner > Apex Triggers > Bulk Apex Triggers, Apex Lightning upload fail because missing test class, How can I modify the meta data of any field using apex, How do i write test class for below apex code, Lightning Web Component Specialist Super badge: Challenge 7, Trailhead Superbadge Logic to create Junction Object, Apex Specialist Challenge 1 too Many DML Rows, Theoretically Correct vs Practical Notation. Set Up Development Org || Apex Specialist Superbadge Education Org's 283 subscribers Subscribe 75 Share 20K views 7 months ago Apex Specialist - Superbadge This is the pre-requisite for Apex. Trigger.new, ApexHTTPHttpHttpRequestHttpResponse Use Git or checkout with SVN using the web URL. private static void testMaintenanceRequestBulk(){ 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 Trailhead private static Map createNewCases(List caseList) { contact.LastName = last; Test.stopTest(); I am getting invalid type schema: for work_part__c, can you help me how to resolve this on, it doesnt seems typo error, but i cant find any field of such type also. I am unaware of any changes. Thats a technical error. contact.Email = test@test.com; test.stopTest(); list allRequests = [select id Udemy would be a paid platform, hence I'll suggest to first exhaust all the free resources and then jump on to Udemy courses. There can be technical errors n it might take more than one time to get it verified. Hope this helps!Looking For? EmailEncodingKey=UTF-8, LastName=Testing, LanguageLocaleKey=en_US, Do I need to do some prep work. system.debug('leastValueMap '+leastValueMap); for(Case c : caseList){ Use Git or checkout with SVN using the web URL. newEMIRecord.Quantity__c=EMIRecord.Quantity__c; 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. Please Guide me.. }, @isTest static void test_triggerMaintenanceRequestHelperTest() {. cas.Status = 'Closed'; product.Replacement_Part__c = true; Thanks again for pointing it out. Actions to Earn This Superbadge Automate record creation using Apex triggers sign in If you're if that type, you can read the apex developer documentation. A tag already exists with the provided branch name. Hi, Its giving error for me . Now, you'll have to map to what needs to done. Are you sure you want to create this branch? TrailheadSalesforce where Maintenance_Request__c = :emptyReq.Id]; system.assert(workPart != null); newEMIRecord.Quantity__c=EMIRecord.Quantity__c; for(Case newCase : [SELECT Id, Comments, Vehicle__c, Status FROM Case WHERE Subject LIKE DummyOK%]){ newItem.Equipment__c = equipmentId; @TestSetup } 'Apex Specialist' is one of the superbadges of Salesforce trailhead(A New Approach to Learning Salesforce). Subject=REQUEST_SUBJECT, Replace male USB-C plug in lenovo charger cable Is it possible to talk with "a staff"? If nothing happens, download Xcode and try again. I highly doubt the entire quest would have changed. MaintenanceRequestTest.CreateData( 5,2,2,Repair); system.debug(newRoutineMaintenanceVehicleRecordIDList +newRoutineMaintenanceVehicleRecordIDList); insert newCases; newItems = new List(); if(!leastValueMap.containsKey(emi.Maintenance_Request__c)){ please help. List newMRRecordList = new List(); Maybe not optimized! Apex SpecialistSuperbadge,Challenge-1 : Automate Record Creation,Challenge-2 : Synchronize Salesforce data with an external system. Please update challenge 6 as well as all the related material. 2022; static testmethod void testjob(){ Also various YouTube videos and blogs exist. , Apex, ApexHttpCalloutMock } 6. list requestList = new list(); Request you to please update Challenge 1. Equipment_Maintenance_Item__c newItem = new Equipment_Maintenance_Item__c(); // Sync with Warehouse maintenanceNew.AccountId = acc.Id; 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 newEMIRecord.Maintenance_Request__c=MRRecord.ID; // This object is available in API version 17.0 and later. Trailhead solution for Apex Specialist superbadge return result; Test callout logic Alternatively you can join our telegram group for technical discussions among industry professionals, Hey komal. If you like what I write and it has been ever helpful to you. Connect on telegram if you again face a similar issue, Hi jaffer. pr.ProductCode = (String)productMap.get(_id); newEquipment.Name = Dummy Equipment; Follow guided learning paths. Apex Specialist is one of the superbadges of Salesforce trailhead(A New Approach to Learning Salesforce). Any help appreciated! 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). }. enter image description here Tried creating another playground but still same issue. 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. Set Up Development Org Trailheads are good for general understanding of a concept whereas the super badge is a test of that concept in a scenario. Case newCase = buildCase(vehicle.Id,'Repair','DummyOK_'+i_ok); Home. I am getting Variable does not exist: MaintenanceRequestTest error. Variable does not exist: Equipment__c Viewed 5k times . If you don't see your @future method in the list, then there's something wrong, but if you . Almost every step has assistance posted on the Salesforce Developer and Trailblazers forums. This repository is for solving all the problems in the way of earning this superbadge. There was a problem preparing your codespace, please try again. LWC Superbadge Step 3 - Setup / Clarification. I am not able understand the issue, can you please help?? // List caselist = [Select count(id) from case where case] for(Case MRRecord: newList){ newCase.Type = 'Routine Maintenance'; check if u have creted a process builder , i did create a proces builder and deactivated and it worked for me. if(MRRecord.Type==Routine Maintenance){ Skip to content. } newEquipment.Maintenance_Cycle__c = 10; 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. Retry the process aforementioned. List secondList = new List(); Account acc = [SELECT Id, Name FROM Account WHERE Name = test LIMIT 1]; newMRRecord.Subject=Routine CheckUp + date.today(); +13,000 points ~12 hrs App Builder Super Set Superbadge Complete the capstone assessment to earn the App Builder Super Set. Start a discussion in the forum to get straight-up answers. for(Integer i_fail = 0; i_fail < 300; i_fail ++){ The WarehouseSyncSchedule apex class does not appear to be queuing a job for the WarehouseCalloutService class. I think you should focus on gaining more of hands on experiences in handling scenarios similar to those in health cloud domain. if(maintenanceCycle>0) 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. @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