Automate Record Creation | Apex Specialist Superbadge

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 48

  • @ciprianmocanu6914
    @ciprianmocanu6914 7 месяцев назад +2

    Close case not available and vehicle from details not available

  • @sarthakmokashi6271
    @sarthakmokashi6271 7 месяцев назад

    Thank you so much Bro🤩 It’s working👍🏻💯

  • @krishnasarathnelluri8223
    @krishnasarathnelluri8223 Год назад +2

    Inserting a new Maintenance Request of type different than 'Repair' and then closing it should not create a new Maintenance Request.

    • @Tech_Electro
      @Tech_Electro 10 месяцев назад +1

      Same problem please replyy anyone how to resolve it

  • @MeghanaSripada-d6c
    @MeghanaSripada-d6c 10 месяцев назад +4

    Challenge Not yet complete... here's what's wrong:
    Closing a Maintenance Request of type 'Routine Maintenance' did not create of a new Maintenance Request related to the same Vehicle . Someone please help :(

    • @vikassabat1803
      @vikassabat1803 7 месяцев назад

      Same problem .Solved the problem?

    • @ciprianmocanu6914
      @ciprianmocanu6914 7 месяцев назад

      Everybody got this

    • @anish8231
      @anish8231 5 месяцев назад

      @@MeghanaSripada-d6c how please tell

    • @Dharshu-xo9mm
      @Dharshu-xo9mm 2 месяца назад

      Same problem..

    • @Dharshu-xo9mm
      @Dharshu-xo9mm 2 месяца назад

      How to rectify that? Please let me know

  • @AdityaKumar-zb5ys
    @AdityaKumar-zb5ys 10 месяцев назад +5

    where is the code ????????????????????????????????????

  • @khushigoyal9840
    @khushigoyal9840 11 месяцев назад +4

    Can i do this module in diff organisation because i have tried a lot to do it in same org but wo ni ho rha h brooo.. please tell meee😭😭😭

    • @YourCoddingBuddy
      @YourCoddingBuddy  11 месяцев назад +1

      Create a new playground and do all the steps from beginning

  • @Dailymantra001
    @Dailymantra001 9 месяцев назад +1

    2:55

  • @psychospace24
    @psychospace24 Год назад +2

    Thanks bro, it really helped

  • @avncreations.....7084
    @avncreations.....7084 11 месяцев назад +1

    Bro i am getting maintenance request.apxt 5 line error

  • @ganireddimahesh799
    @ganireddimahesh799 Год назад +1

    Maintenance request option is not showing😭😭please help me

  • @munagasaiteja7922
    @munagasaiteja7922 11 месяцев назад +1

    Closing a maintenance request of type 'routine maintenance ' did not create of a new maintenance request related to same vehicle
    Its showing 13 errors bro please slove my problem😭

    • @BlackBall-
      @BlackBall- 6 месяцев назад

      U got the solution?

  • @YourCoddingBuddy
    @YourCoddingBuddy  Год назад +23

    ********************** MaintenanceRequestHelper Class *******************
    public with sharing class MaintenanceRequestHelper {
    public static void updateworkOrders(List updWorkOrders, Map nonUpdCaseMap) {
    Set validIds = new Set();


    For (Case c : updWorkOrders){
    if (nonUpdCaseMap.get(c.Id).Status != 'Closed' && c.Status == 'Closed'){
    if (c.Type == 'Repair' || c.Type == 'Routine Maintenance'){
    validIds.add(c.Id);


    }
    }
    }

    if (!validIds.isEmpty()){
    List newCases = new List();
    Map closedCasesM = new Map([SELECT Id, Vehicle__c, Equipment__c, Equipment__r.Maintenance_Cycle__c,(SELECT Id,Equipment__c,Quantity__c FROM Equipment_Maintenance_Items__r)
    FROM Case WHERE Id IN :validIds]);
    Map maintenanceCycles = new Map();
    AggregateResult[] results = [SELECT Maintenance_Request__c, MIN(Equipment__r.Maintenance_Cycle__c)cycle FROM Equipment_Maintenance_Item__c WHERE Maintenance_Request__c IN :ValidIds GROUP BY Maintenance_Request__c];

    for (AggregateResult ar : results){
    maintenanceCycles.put((Id) ar.get('Maintenance_Request__c'), (Decimal) ar.get('cycle'));
    }

    for(Case cc : closedCasesM.values()){
    Case nc = new Case (
    ParentId = cc.Id,
    Status = 'New',
    Subject = 'Routine Maintenance',
    Type = 'Routine Maintenance',
    Vehicle__c = cc.Vehicle__c,
    Equipment__c =cc.Equipment__c,
    Origin = 'Web',
    Date_Reported__c = Date.Today()

    );

    If (maintenanceCycles.containskey(cc.Id)){
    nc.Date_Due__c = Date.today().addDays((Integer) maintenanceCycles.get(cc.Id));
    } else {
    nc.Date_Due__c = Date.today().addDays((Integer) cc.Equipment__r.maintenance_Cycle__c);
    }

    newCases.add(nc);
    }

    insert newCases;

    List clonedWPs = new List();
    for (Case nc : newCases){
    for (Equipment_Maintenance_Item__c wp : closedCasesM.get(nc.ParentId).Equipment_Maintenance_Items__r){
    Equipment_Maintenance_Item__c wpClone = wp.clone();
    wpClone.Maintenance_Request__c = nc.Id;
    ClonedWPs.add(wpClone);

    }
    }
    insert ClonedWPs;
    }
    }
    }
    *************************** MaintenanceRequest trigger class ****************************
    trigger MaintenanceRequest on Case (before update, after update) {
    if(Trigger.isUpdate && Trigger.isAfter){
    MaintenanceRequestHelper.updateWorkOrders(Trigger.New, Trigger.OldMap);
    }
    }

  • @pallavikrishna967
    @pallavikrishna967 11 месяцев назад +1

    Close case is not showing in feed

  • @MeghanaMangamuri
    @MeghanaMangamuri 10 месяцев назад

    Closing a Maintenance Request of type 'Routine Maintenance' did not create of a new Maintenance Request related to the same Vehicle.
    HELP ME FOR THIS QUERY

    • @BlackBall-
      @BlackBall- 6 месяцев назад

      U got the solution?

  • @abhinavkumartripathi995
    @abhinavkumartripathi995 6 месяцев назад

    where is that whole code ???

  • @vamsi.d8276
    @vamsi.d8276 6 месяцев назад

    bro i am not getting 'how we roll maintainance',how can i get it bro.
    Please give me solution bro.....

    • @Lucifer-jl9vh
      @Lucifer-jl9vh 6 месяцев назад +1

      bro install the unlocked package, it is given above

  • @ganireddimahesh799
    @ganireddimahesh799 Год назад +2

    Maintenance request option is not showing😭😭

  • @squidgamer004
    @squidgamer004 10 месяцев назад

    sir code de do

  • @srikanthtalks4877
    @srikanthtalks4877 Год назад +2

    tnx bro