So glad you cared to share this. } system.debug('leastValueMap '+leastValueMap); for(Case c : caseList){ Http http = new Http(); List newEMIRecordList = new List(); SYSTEM.assertEquals(newReq.ProductId, equipmentId); public with sharing class MaintenanceRequestHelperTest {. I am working on "Advanced Apex Specialist" Superbadge but I am not able to pass challenge 1 as it keeps on showing me that Select one label is not created. Copy the name of the package and use this command in the terminal. The challenge is expecting the due date to be calculated using the maintenance cycle defined on the related equipment records. Use integration and business logic to push your Apex coding skills to the limit with the Apex Specialist superbadge. request.setEndpoint(WAREHOUSE_URL); Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. 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 I've successfully create a . @istest pr.Maintenance_Cycle__c = (Integer)productMap.get(maintenanceperiod); Laendor code is not working. for this code: @isTest Lets grow together. If you like what I write and it has been ever helpful to you. Thanks for your wonderful gesture of letting know, I am also geating the same error . If you search regarding Apex on YouTube you'll find many more channels and videos. newProducts.add(pr); } 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. System.debug(*** Updated cases: +caseToUpdate.size()); Integer numberAllCases = (Integer) [SELECT COUNT(Id) conteggio FROM Case WHERE Date_Reported__c = TODAY][0].get(conteggio); maintenanceNew.Status = 'New'; Do I need to do some prep work. Please update challenge 6 and all the respective things related to it. // Sync with Warehouse for(Integer i_fail = 0; i_fail < 300; i_fail ++){ for(Equipment_Maintenance_Item__c EMIRecord: EMIList){ newMRRecord.Vehicle__c = MRRecord.Vehicle__c; } from Case where status = :STATUS_NEW]; Equipment_Maintenance_Item__c workPart = [select id pr.ProductCode = (String)productMap.get(_id); MaintenanceRequestHelper.createNewEquipmentMaintenanceItem(Trigger.newMap); Hi Niya. System.debug(*** Total cases (expected 900): +numberAllCases); List newCaseList = new List(); I highly doubt the entire quest would have changed. , Super contact.Email = test@test.com; 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. 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. SYSTEM.assertEquals(newReq.Vehicle__c, vehicleId); return cs; Refresh the page, check. @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(){. 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. Superbadge will have some hints on what you are expected to do. newCase.Origin=web; newCases.add(newCase); This is probably the simplest of all the steps.. update theTestDataFactory class to handle the key requirements given.. im stuck in challenge 4. if(res.get(cycle)!=null){ @isTest How Intuit democratizes AI development across teams through reusability. I have complete Idea of this coding bt I am not getting what to do before writing this code exactly for this challenge. request.setMethod(GET); Learn directly from Salesforce experts. maintenanceNew.Subject = 'Other'; maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; So with that I could solve it. from Equipment_Maintenance_Item__c Decimal maintenanceCycle = 0; 0. list requestList = new list(); Product2 pr = new Product2(); for(Case MRRecord: newList){ WHERE Maintenance_Request__c IN :setIdCases]; Map mapCases = new Map(); Need help on specific errors? Challenge 4 - MaintenanceHelperTest.class 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. Account acc = new Account(); from Equipment_Maintenance_Item__c Please edit your answer to include an explanation of your code. I worked through the Exam Prep guidelines. newEMIRecord.Quantity__c=EMIRecord.Quantity__c; contact.FirstName = test; Accelerate learning across your organization. } Test scheduling logic to confirm action gets queued. SYSTEM.assertEquals(newReq.Date_Reported__c, system.today()); @istest acc.Name = test; mapCases.put(oldCaseId,new List()); Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. newCase.Equipment__c = leastValueMap.get(c.Id).Equipment__c; }. Maintenance Request to the same vehicle . pr.Replacement_Part__c = (Boolean)productMap.get(replacement); Modified 2 months ago. Advanced Apex Specialist Superbadge - Step 3 Issue . MRRecord.Date_Due__c=MRRecord.Date_Due__c + integer.valueOf(maintenanceCycle); } if(Trigger.isInsert){ 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. Please find the link to telegram group on the homepage! newRoutineMaintenanceVehicleRecordIDList.add(MRRecord.Vehicle__c); Thats a technical error. private static final string REQUEST_TYPE = Routine Maintenance; }. Advanced-Apex-Specialist-Salesforce-Super-Badge. 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. contact.LastName = last; return Vehicle; SELECT Maintenance_Request__r.ID cID, MIN(Equipment__r.Maintenance_Cycle__c)cycle salesforce Share Improve this question Follow https://salesforce.stackexchange.com/questions/336871/apex-specialist-challenge-1-productid-null/341363#341363. insert vehicleList; newCase.Comments = New comment!; addDays+=daysToAdd; System.enqueueJob(New WarehouseCalloutService()); public with sharing class MaintenanceRequestHelperTest {. newMRRecord.Subject=Routine CheckUp + date.today(); } Date newDate = Date.today(); if(result.get(oneCase.Id)!=null) { insert newMRRecordList; Help with Superbadge Apex Specialist Step 3? Is there a specific import order? System.assert(numberAllCases==900); Are you sure you want to create this branch? A place where magic is studied and practiced? Test.startTest(); Map mapOldCasesWithItems = getItemsInOldCases(caseList); Press question mark to learn the rest of the keyboard shortcuts. } Reddit and its partners use cookies and similar technologies to provide you with a better experience. What is a word for the arcane equivalent of a monastery? Its been long time I completed those quests. insert vehicle; Tips, ApexWeb APIApexDML1, Trigger.new sObject List Review the data schema in your modified Salesforce org as you read the detailed requirements below. Please note that I also have separate method to cover positive and negative scenarios. Hot Network Questions Would merfolk need beds? if(MRRecord.Vehicle__c==EMIRecord.Maintenance_Request__r.Vehicle__c){ Apex Specialist. Test callout logic Hi, Its giving error for me . If you are facing any hurdles to complete the challenge, just go through the code. public with sharing class WarehouseCalloutService implements queueable, Database.AllowsCallouts {. insert equipment; newCase.Subject=Routine Maintenance of Vehicle; It's pretty comprehensive and contains several examples. , Greeting Laendor, Here I have no idea what the input is nor what the output is supposed to be. list workPartList = new list(); List listEquipmentMaintenanceItem = Rename cases and products to match the HowWeRoll schema, and assign all profiles to the custom HowWeRoll page layouts for those objects. Challenge 2: Synchronize Salesforce data with an external system. if(response.getStatusCode() == 200) } 3 Answers. Hi, If nothing happens, download GitHub Desktop and try again. I do know the core concepts but I am missing the connection. Equipment_Maintenance_Item__c newEMIRecord = new Equipment_Maintenance_Item__c(); Start a discussion in the forum to get straight-up answers. Trails. }. maintenanceNew.Product__c = product.Id; } }, @isTest static void test_triggerMaintenanceRequestHelperTest() {. Contact contact = [SELECT Id, FirstName, LastName,Email,AccountId FROM Contact WHERE Email = test@test.com LIMIT 1]; There was a problem preparing your codespace, please try again. insert newCases; newItems = new List(); Concepts tested in this superbadge include: Apex Triggers . Trigger.new, ApexHTTPHttpHttpRequestHttpResponse lifespan_months__C = 10, 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 {. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Apex Specialist. Change the CodesGo to Developer console and edit the Apex class and related triggers for below: Issue with Superbadge Apex Specialist Step 2? I had posted these at the time i completed them. newEquipment.Replacement_Part__c = true; public static Case buildCase(Id vehicleId, String typeCase, String subjectCase){ Also some of the functions come predefined and it might be that as well. } oldNewCaseMap.put(c.Id,newCase); For Challenge 1 I am getting error for some of the fields that they doesnt exist like Vehicle__c, Equipment__c, Due_Date__c. But i will surely get back to you on this. When I jumped into the super badge I realised that lack a lot of info surrounding the Superbadge. Vehicle__c vehicle = buildVehicle(); if(!EquipmentIDListUpdate.contains(EMIRecord.Equipment__c)){ Please help! } 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). Process Automation Specialist step 7 no work. same error for me too.. can you please help me out, hi Salesforce[] [] [], REST API We are always on the hunt for writers that have something interesting to say! } insert emiListToBeUpdated; 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 that, I would suggest the following udemy course: Salesforce Development Course. https://developer.salesforce.com/docs/atlas.ja-jp.apexcode.meta/apexcode/apex_scheduler.htm, ApexGUISchedulable Apex, [] [] [Apex] Apex , GUISalesforce I am unaware of any changes. Challenge Not yet complete heres whats wrong: 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. Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. Do we need to create this lookup relationship between Maintenance Request (Case) and Equipment (Product)? A tag already exists with the provided branch name. } Level Up with Salesforce and Win Free Certificate voucher! insert somethingToUpdate; Equipment_Maintenance_Item__c workP = createWorkPart(equipmentId,somethingToUpdate.id); for(case req : requestList){ Find centralized, trusted content and collaborate around the technologies you use most. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. maintenanceNew.ContactId = contact.Id; } return result; Use above code for step 5 and then use system assert with constant 0 and returned value will be 0. } newCase.Vehicle__c = c.Vehicle__c; System.assertEquals(1000,caseList.size()); for(Case cas:caseList){ My Blog explains about the steps for completing this super badge. 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?). You have to insert as many work parts records for each inserted new case record. } Paste it below to help someone else looking. system.debug(newEMIRecordList.size() +newEMIRecordList.size()); I will try and review that shortly and update the required. newCase.Comments = New comment!; Retry the process aforementioned. public static void setupTest(){ system.debug('newCaseList '+newCaseList); maintenanceCycle=EMIRecord.Equipment__r.Maintenance_Cycle__c; List tmpCases = new List(); We have a small group to help out each others. All these codes are working 100% and run smoothly to help you achieve the below shiny badge. A tag already exists with the provided branch name. Test.stopTest(); // List caselist = [Select count(id) from case where case] newItem.Maintenance_Request__c = caseId; EquipmentIDListUpdate.add(EMIRecord.Equipment__c); You have to rename the two standard fields as indicated and then the mentioned changes in apex and trigger codes. sign in Connect on telegram if you again face a similar issue, Hi jaffer. Product needs to be renamed as Equipment not Vehicle since Vehicle is already provided to us in the installed package. Cant remember precisely. product2 equipment = new product2(name = SuperEquipment, Do lemme know if you find solutions codes that work well for it. System.debug(*** Updated cases: +caseToUpdate.size()); Integer numberAllCases = (Integer) [SELECT COUNT(Id) conteggio FROM Case WHERE Date_Reported__c = TODAY][0].get(conteggio); For that, I would suggest the following udemy course: Salesforce Development Course. } if(maintenanceCycle==0){ SELECT Id, Maintenance_Request__c, Equipment__c , Quantity__c They do give you a template and a requirements sheet. Case newMRRecord = new Case(); Profile p = [SELECT Id FROM Profile WHERE Name=Standard User]; Test.stopTest(); Product2 newEquipment = new Product2(); newEMIRecord.Equipment__c=EMIRecord.Equipment__c; List wpc= [ maintenanceNew.Date_Reported__c = Date.today(); If nothing happens, download Xcode and try again. for(Case MRRecord: newMap.values()){ }, Hey sam! Choose the Tab (orObject) you want torenameand clickEdit. Now, you'll have to map to what needs to done. newEquipment.Lifespan_Months__c = 10; CronTrigger is similar to a cron job on UNIX systems. insert workPartList; test.startTest(); jaran@wezana.solutions, @isTest system.debug(newRoutineMaintenanceVehicleRecordIDList +newRoutineMaintenanceVehicleRecordIDList); List emiList = new List(); List EquipmentIDListUpdate = vehicleToEquipmentMap.get(MRRecord.Vehicle__c); I tried to use your code as it is and it gives error..For this superbadge I already read on 7th Dec that Superbadge challenge will be changed on 9th Dec and I am unaware about old superbadge so cant tell you what actual changes are. newCases.add(newCase); I started working on this superbadge and this post is to document some of the findings / tips / gotchas as I progress through this one. This query will return all completed batch, future, and queryable jobs that were completed today. product.Name = test; LocaleSidKey=en_US, ProfileId = p.Id, 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. if (!mapCases.containsKey(oldCaseId)){ } 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]); Vehicle__c vehicle = [SELECT Id, Name FROM Vehicle__c WHERE Name = car LIMIT 1]; I ll look into it and get back to you shortly. Hi Shaid, Please use below code:-. id vehicleId = vehicle.Id; product2 equipment = createEq(); for(Equipment_Maintenance_Item__c item: lista){ Case newCase = new Case(); insert contact; Vehicle__c vehicle = new Vehicle__c(); Map result = getDueDate(caseList); for(Case oneCase : caseList) { Work fast with our official CLI. Maybe not optimized! Use the included package content to . } }. It should work. newCase.Subject = 'Test Subject'; Trailhead, , (Super Badge) } newCase.Date_Due__c=Date.today(); public static Equipment_Maintenance_Item__c buildItem(Id caseId, Id equipmentId){ newEMIRecordList.add(newEMIRecord); ~1 hr 30 mins +1,500 points Module Apex Testing Write robust code by executing Apex unit tests. Apex Specialist is one of the superbadges of Salesforce trailhead(A New Approach to Learning Salesforce). 5 Comments on Apex Superbadge (part-1) Scenario:- Automate record creation. }. Good luck to you all if you are working on this superbadge or preparing for the Salesforce Platform Developer II certification. I am stuck in challenge 6. }, public static void createNewEquipmentMaintenanceItem(Map newMap){ It looks good on a resume to be a contributor. Also search for blogs, articles regarding it. Synchronize Salesforce data with an external system using asynchronous REST callouts. User u = new User(Alias = stdtest, Email=stdtest@testorg.com, list oldRequestIds = new list(); for(integer i = 0; i < 300; i++){ public static void testPositive(){ Invalid type: Schema.Work_Part__c, Use variable as ProductId instaed of Equipment__c } Try running this query in your developer org: SELECT Id, JobType, MethodName, Status FROM AsyncApexJob WHERE CompletedDate = TODAY. But I have created it as you can see in below image. For any superbadge, you will have to install a package before starting. Learn more. With that being said, it seems like you need more understanding of the apex coding language in general. insert product; if(!newRoutineMaintenanceVehicleRecordIDList.contains(MRRecord.Vehicle__c)) for(Case MRRecord: newMap.values()){ insert vehicle; This superbadges require a bit of practical experience in apex and all of them are not available on trailhead. The region and polygon don't match. }. Apex specialist superbadge challenge 4. }, if(Trigger.isAfter){ Hi @Edgar Moran, Can you please send me complete code of this "Unlock the Apex Specialist Superbadge". Change the labels for Case and Product To Maintenance Request and Equipment respectively. } Ask Question Asked 1 year, 3 months ago. 'Apex Specialist' is one of the superbadges of Salesforce trailhead(A New Approach to Learning Salesforce). workPartList.add(createWorkPart(equipmentList.get(i).id, requestList.get(i).id)); Method does not exist or incorrect signature: void CreateData(Integer, Integer, Integer, String) from the type MaintenanceRequestHelper. for(Case MRRecord: newMap.values()){ Set oldIdCases = newCases.keySet(); With that being said, it seems like you need more understanding of the apex coding language in general.