• Miguel Roa
  • NEWBIE
  • 30 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
Any help whit a test class for this class please, I can't find any example on the internet.
 
public without sharing class OpportunityUpdate_WithDVSSCaseHelper {
    
    public static void UpdateOpptyStatusForOpptyWithDVSSCases_OnPegaSide(List<Opportunity> newOppty,Map<Id,Opportunity> oldOppty){
      
        Map<String,String> DvssCaseTypes = new Map<String,String>();
        DvssCaseTypes.put('DVSS AM', 'DVSSAM'); 
        DvssCaseTypes.put('DVSS CPE','DVSSCPE');
        DvssCaseTypes.put('DVSS DR','DVSSDR');
        DvssCaseTypes.put('DVSS RFP','DVSSRFP');
    
        List<Id> opptyIds = new List<Id>();
        List<Opportunity> opptiesToUpdateOnPega;   
        
        List<WrapperDVSSOpptyStageUpdateService> wrappers = new List<WrapperDVSSOpptyStageUpdateService>();
        for(Opportunity oppty:newOppty){
            
            Opportunity oldOp = oldOppty.get(oppty.Id);
            if(oppty.StageName != oldOp.StageName && (oppty.StageName =='5 Closed Lost' || oppty.StageName =='5 Closed Disqualified' ) ){
                opptyIds.add(oppty.Id);
            }
            
        }   
        
        
        if(opptyIds.size() > 0){

            opptiesToUpdateOnPega = [select Id,StageName,(SELECT Case_Type__c,SWAP_Case_ID__c FROM SWAPS_Tracker__r where case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) 
                                     from Opportunity where Id in:opptyIds and Id in(select Opportunity_Name__c from SWAP_Tracker__c
                                                                                     where Opportunity_Name__c in:opptyIds and case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) ];

           if(opptiesToUpdateOnPega.size() > 0){
                
                for(Opportunity opp:opptiesToUpdateOnPega){
                    
                    List<SWAP_Tracker__c> swTrack = opp.SWAPS_Tracker__r;
                    
                    system.debug('Oppt info LP>> ' + opp);
                    DateTime dtvar = null;
                    String Casetype='' ;
                    String CaseId='';
            
                    string OpptyStatus = opp.StageName;
                    
                        for(SWAP_Tracker__c swt:swTrack){
                            
                            Casetype =  (DvssCaseTypes.get(swt.Case_Type__c) == null)?'':DvssCaseTypes.get(swt.Case_Type__c);
                            CaseId = (swt.SWAP_Case_ID__c ==null)?'':swt.SWAP_Case_ID__c;
                            
                            WrapperDVSSOpptyStageUpdateService wp = new WrapperDVSSOpptyStageUpdateService();
                            wp.Casetype =  Casetype;
                            wp.CaseId = CaseId;
                            wp.OpptyStatus = OpptyStatus;
                            wrappers.add(wp);
                        }
                }
            }
        }
    }
}

Thanks
Hello guys, I'm really new to APEX/Salesforce and I've been told to write a test class.

The thing is that all the examples that I see online are for really simple classes and this one is kinda complicated.

Can someone help me with this or point me in the right direction?

Thanks in advance.

This is the class:
 
public without sharing class OpportunityUpdate_WithDVSSCaseHelper {
    
    public static void UpdateOpptyStatusForOpptyWithDVSSCases_OnPegaSide(List<Opportunity> newOppty,Map<Id,Opportunity> oldOppty){
      
        Map<String,String> DvssCaseTypes = new Map<String,String>();
        DvssCaseTypes.put('DVSS AM', 'DVSSAM'); 
        DvssCaseTypes.put('DVSS CPE','DVSSCPE');
        DvssCaseTypes.put('DVSS DR','DVSSDR');
        DvssCaseTypes.put('DVSS RFP','DVSSRFP');
    
        List<Id> opptyIds = new List<Id>();
        List<Opportunity> opptiesToUpdateOnPega;   
        
        List<WrapperDVSSOpptyStageUpdateService> wrappers = new List<WrapperDVSSOpptyStageUpdateService>();
        for(Opportunity oppty:newOppty){
            
            Opportunity oldOp = oldOppty.get(oppty.Id);
            if(oppty.StageName != oldOp.StageName && (oppty.StageName =='5 Closed Lost' || oppty.StageName =='5 Closed Disqualified' ) ){
                opptyIds.add(oppty.Id);
            }
            
        }   
        
        
        if(opptyIds.size() > 0){

            opptiesToUpdateOnPega = [select Id,StageName,(SELECT Case_Type__c,SWAP_Case_ID__c FROM SWAPS_Tracker__r where case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) 
                                     from Opportunity where Id in:opptyIds and Id in(select Opportunity_Name__c from SWAP_Tracker__c
                                                                                     where Opportunity_Name__c in:opptyIds and case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) ];

           if(opptiesToUpdateOnPega.size() > 0){
                
                for(Opportunity opp:opptiesToUpdateOnPega){
                    
                    List<SWAP_Tracker__c> swTrack = opp.SWAPS_Tracker__r;
                    
                    system.debug('Oppt info LP>> ' + opp);
                    DateTime dtvar = null;
                    String Casetype='' ;
                    String CaseId='';
            
                    string OpptyStatus = opp.StageName;
                    
                        for(SWAP_Tracker__c swt:swTrack){
                            
                            Casetype =  (DvssCaseTypes.get(swt.Case_Type__c) == null)?'':DvssCaseTypes.get(swt.Case_Type__c);
                            CaseId = (swt.SWAP_Case_ID__c ==null)?'':swt.SWAP_Case_ID__c;
                            
                            WrapperDVSSOpptyStageUpdateService wp = new WrapperDVSSOpptyStageUpdateService();
                            wp.Casetype =  Casetype;
                            wp.CaseId = CaseId;
                            wp.OpptyStatus = OpptyStatus;
                            wrappers.add(wp);
                        }
                    }
                
                DVSSOpptyStageUpdateService updateServicePega = new DVSSOpptyStageUpdateService();
                updateServicePega.lst = wrappers;
        
                system.enqueueJob(updateServicePega);
            }
        }
    }
        
    public class DVSSOpptyStageUpdateService implements Queueable, Database.AllowsCallouts {
        
        public List<WrapperDVSSOpptyStageUpdateService> lst{get;set;}
        
        public void execute(QueueableContext context){
            
            system.debug('LL- Calling to update oppty stage');
            
            try{
                
                for(WrapperDVSSOpptyStageUpdateService wrp : lst){
                   
                        Pega_CaseMiddleware.PegaCaseResult pagecaserslt = Pega_CaseMiddleware.UpdateDVSSCases_OpptyStatus(wrp.Casetype,wrp.CaseId,wrp.OpptyStatus);
                        
                        If(pagecaserslt.Error.size()>0){                
                            
                            system.debug('LL- error Message>>> ' + pagecaserslt.Error);
                        }
                        else{
                            
                            system.debug('LL- Success Message>>> ' + pagecaserslt.CaseID);
                        } 
                }
            }
            catch(Exception ex){
                
                system.debug('LL-Errrrror: ' + ex.getMessage()+ ' -- ' + ex.getStackTraceString() + '-- ' + ex.getLineNumber());
                insertLog('outbound', '-1', ex.getMessage()+ ex.getStackTraceString() + ex.getLineNumber(), 'DVSSOpptyStageUpdateService');    
            }
        }
    }
    
    public class WrapperDVSSOpptyStageUpdateService {
        
        public string Casetype{get;set;}
        public string CaseId{get;set;}
        public string OpptyStatus{get;set;}
    }
    
    public static void insertLog(String inboundOutbound, string requestID, string message, string method){
        
        try {
            
            Event_Log__c log = new Event_Log__c();
            
            log.Record_Id__c = requestID;
            log.Operation__c = inboundOutbound;
            log.sObject_Type__c ='SWAP Case';
            log.Message__c = 'pega_salesforce_inbound_outbound';
            log.Line_Number__c = method;
            log.Notes__c = message;
            
            insert log;
        }
        catch (Exception ex) {
            System.debug(ex.getMessage());
        }
    }
}

 
Hello, I have this class that is excecuted by a Batchable

And I getting the following error on the log: FATAL_ERROR System.LimitException: Too many queueable jobs added to the queue: 2

According to some posts that I've read, the issue is because I have system.enqueueJob(dvssService) inside a for loop.
 
public without sharing class OpportunityUpdate_WithDVSSCaseHelper {
    
    public static void UpdateOpptyStatusForOpptyWithDVSSCases_OnPegaSide(List<Opportunity> newOppty,Map<Id,Opportunity> oldOppty){
      
        Map<String,String> DvssCaseTypes = new Map<String,String>();
        DvssCaseTypes.put('DVSS AM', 'DVSSAM'); 
        DvssCaseTypes.put('DVSS CPE','DVSSCPE');
        DvssCaseTypes.put('DVSS DR','DVSSDR');
        DvssCaseTypes.put('DVSS RFP','DVSSRFP');
    
        List<Id> opptyIds = new List<Id>();
        List<Opportunity> opptiesToUpdateOnPega;       
        for(Opportunity oppty:newOppty){
            
            Opportunity oldOp = oldOppty.get(oppty.Id);
            if(oppty.StageName != oldOp.StageName && (oppty.StageName =='5 Closed Lost' || oppty.StageName =='5 Closed Disqualified' ) ){
                opptyIds.add(oppty.Id);
            }
            
        }   
        
        
        if(opptyIds.size() > 0){
            
            
            opptiesToUpdateOnPega = [select Id,StageName,(SELECT Case_Type__c,SWAP_Case_ID__c FROM SWAPS_Tracker__r where case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) 
                                     from Opportunity where Id in:opptyIds and Id in(select Opportunity_Name__c from SWAP_Tracker__c
                                                                                     where Opportunity_Name__c in:opptyIds and case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) ];

            
            if(opptiesToUpdateOnPega.size() > 0){
             
                               
                
                for(Opportunity opp:opptiesToUpdateOnPega){
                    
                    List<SWAP_Tracker__c> swTrack = opp.SWAPS_Tracker__r;
                    
                    system.debug('Oppt info LP>> ' + opp);
                    DateTime dtvar = null;
                    String Casetype='' ;
                    String CaseId='';
            
                    string OpptyStatus = opp.StageName;
                    
                    
                        for(SWAP_Tracker__c swt:swTrack){
                            
                            Casetype =  (DvssCaseTypes.get(swt.Case_Type__c) == null)?'':DvssCaseTypes.get(swt.Case_Type__c);
                            CaseId = (swt.SWAP_Case_ID__c ==null)?'':swt.SWAP_Case_ID__c;
     
                           
                DVSSOpptyStageUpdateService dvssService = new DVSSOpptyStageUpdateService();
                dvssService.Casetype = Casetype;
                dvssService.CaseId = CaseId;
                dvssService.OpptyStatus = OpptyStatus;
                
                system.enqueueJob(dvssService);                
                
            }  

            
            
        }


        
        
     }


   }

}
        
    public class DVSSOpptyStageUpdateService implements Queueable, Database.AllowsCallouts {
        

        public string Casetype{get;set;}
        public string CaseId{get;set;}
        public string OpptyStatus{get;set;}
        
        
        
        public void execute(QueueableContext context){
            
            

            
            system.debug('LL- Calling to update oppty stage');
            
            try{
                
            
                        Pega_CaseMiddleware.PegaCaseResult pagecaserslt = Pega_CaseMiddleware.UpdateDVSSCases_OpptyStatus(Casetype,CaseId,OpptyStatus);
                        
                        If(pagecaserslt.Error.size()>0){                
                            
                            system.debug('LL- error Message>>> ' + pagecaserslt.Error);
                            
                            
                            
                        }
                        else{
                            
                            system.debug('LL- Success Message>>> ' + pagecaserslt.CaseID);
                            
                        } 
                        
                
                
                
            }
            catch(Exception ex){
                
                system.debug('LL-Errrrror: ' + ex.getMessage()+ ' -- ' + ex.getStackTraceString() + '-- ' + ex.getLineNumber());
                insertLog('outbound', '-1', ex.getMessage()+ ex.getStackTraceString() + ex.getLineNumber(), 'DVSSOpptyStageUpdateService');    
                
            }
            
            
        }
        
        
    }
    
    public static void insertLog(String inboundOutbound, string requestID, string message, string method){
        
        try {
            
            Event_Log__c log = new Event_Log__c();
            
            log.Record_Id__c = requestID;
            log.Operation__c = inboundOutbound;
            log.sObject_Type__c ='SWAP Case';
            log.Message__c = 'pega_salesforce_inbound_outbound';
            log.Line_Number__c = method;
            log.Notes__c = message;
            
            insert log;
            
            
        } catch (Exception ex) {
            System.debug(ex.getMessage());
        }
        
        
    }
    
}
Is there any way to refactor this code?
I tried to create a list and then use it as an argument for the enqueueJob like this:
if(opptiesToUpdateOnPega.size() > 0){
             
                //List to collect the dvssService that are going to be enqueable-.
                List<DVSSOpptyStageUpdateService> dvssServiceLst = new List<DVSSOpptyStageUpdateService>();
                
                for(Opportunity opp:opptiesToUpdateOnPega){
                    
                    List<SWAP_Tracker__c> swTrack = opp.SWAPS_Tracker__r;
                    
                    system.debug('Oppt info LP>> ' + opp);
                    DateTime dtvar = null;
                    String Casetype='' ;
                    String CaseId='';
            
                    string OpptyStatus = opp.StageName;
                    
                    
                        for(SWAP_Tracker__c swt:swTrack){
                            
                            Casetype =  (DvssCaseTypes.get(swt.Case_Type__c) == null)?'':DvssCaseTypes.get(swt.Case_Type__c);
                            CaseId = (swt.SWAP_Case_ID__c ==null)?'':swt.SWAP_Case_ID__c;
     
                           
                DVSSOpptyStageUpdateService dvssService = new DVSSOpptyStageUpdateService();
                dvssService.Casetype = Casetype;
                dvssService.CaseId = CaseId;
                dvssService.OpptyStatus = OpptyStatus;
                
                dvssServiceLst.add(dvssService);
                
            }  

            
        }
        
        //Taking the enqueueJob out of the for loop-.
        system.enqueueJob(dvssServiceLst);


     }

But then I got an error (I can't remember the error exactly and my dev console is acting up so I can't replicate it) that said something like class List<DVSSOpptyStageUpdateService> needs to implemet queueable (I can't remember the error exactly and my dev console is acting up so I can't replicate it)

Any help with this, thank you very much.
 
Hello, I'm new to Salesforce and I've been told to write a test class for this class and frankly I don't know where to start.

The thing is that the examples I've found on trailblaze only cover really simple classes with numeric returns.

Could you please provide some guidance? Thanks in advance.

This is the aforementioned class:
public class BlacklistLeadValidation {
    
    public static string errorMsg { 
        get { 
            return 'Your attempt to change the [FieldName] status was not successful due to insufficient privileges. Please send a chatter post to #help with supporting documentation for the change request.';
        }
    }
    
    public static void OptInWireless_Wireline(Map<Id, Lead> leadRecord, Map<Id, Lead> leadRecordOld)
    {
        if (leadRecord != null && leadRecordOld != null)
        {
            List<Profile> currentUserProfile  = [Select Id, Name From Profile Where Id = :UserInfo.getProfileId()];
            if (currentUserProfile.size() > 0)
            {
                if (!Label.AP_VBM_ApprovalAllowedProfiles.containsIgnoreCase(currentUserProfile[0].Name)) {
                    for(id recId : leadRecord.keySet())
                    {
                        Lead leadOld = leadRecordOld.get(recId);
                        Lead leadNew = leadRecord.get(recId);
                        
                        // Wireline consent validation (booleans cannot moved from true to false)
                        if (leadOld.Do_Not_Call__c == true && leadNew.Do_Not_Call__c == false)
                        {
                            leadNew.Do_Not_Call__c.addError(errorMsg.replace('[FieldName]', 'Do Not Call'));
                        }
                        
                        if (leadOld.Do_Not_Mail__c == true && leadNew.Do_Not_Mail__c == false)
                        {
                            leadNew.Do_Not_Mail__c.addError(errorMsg.replace('[FieldName]', 'Do Not Mail'));
                        }
                        
                        
                        if (leadOld.HasOptedOutOfEmail == true && leadNew.HasOptedOutOfEmail == false)
                        {
                            leadNew.HasOptedOutOfEmail.addError(errorMsg.replace('[FieldName]', 'Do Not Email'));
                        }
                        
                        
                        
                        // Wireless consent validation (booleans cannot moved from true to false)
                        if (leadOld.Do_Not_Email_VZW__c == true && leadNew.Do_Not_Email_VZW__c == false)
                        {
                            leadNew.Do_Not_Email_VZW__c.addError(errorMsg.replace('[FieldName]', 'Do Not Email Wireless'));
                        }
                        
                        if (leadOld.Do_Not_Call_VZW__c == true && leadNew.Do_Not_Call_VZW__c == false)
                        {
                            leadNew.Do_Not_Call_VZW__c.addError(errorMsg.replace('[FieldName]', 'Do Not Call Wireless'));
                        }
                        
                        if (leadOld.Do_Not_Mail_VZW__c == true && leadNew.Do_Not_Mail_VZW__c == false)
                        {
                            leadNew.Do_Not_Mail_VZW__c.addError(errorMsg.replace('[FieldName]', 'Do Not Mail Wireless'));
                        }
                        
                        // Not Opt In cannot be change either for wireline or wireless
                        if (leadOld.Email_Opt_In__c == 'No Opt In' && leadNew.Email_Opt_In__c != 'No Opt In')
                        {
                            leadNew.Email_Opt_In__c.addError(errorMsg.replace('[FieldName]', 'Email Opt In'));
                        }
                        
                        if (leadOld.Email_Opt_In_VZW__c == 'No Opt In' && leadNew.Email_Opt_In_VZW__c != 'No Opt In')
                        {
                            leadNew.Email_Opt_In_VZW__c.addError(errorMsg.replace('[FieldName]', 'Email Opt In Wireless'));
                        }
                        
                    }
                }
            }  
        }
        
    }
    
}

 
Hi, I'm new in APEX and I've been told to fix this test class:
 
@Istest
Public class MillisecondBatchConvertController_Test{
public static testMethod void testBatch() {
       
    Team_Form__c tfCustom = new Team_Form__c();
    tfCustom = [Select Id from Team_Form__c LIMIT 1];
    List <PS_TF_Status_Track__c> stList = new List<PS_TF_Status_Track__c>();
    for(integer count = 0; count<=1; count++){
        PS_TF_Status_Track__c st = new PS_TF_Status_Track__c(Hours__c=count,Minutes__c=count,Days__c=count,Team_Form__c=tfCustom.Id);
     stList.add(st);}
       
        insert stList;
       
        Test.startTest();
        MillisecondBatchConvertController mbcCon=new MillisecondBatchConvertController();
        ID batchprocessid = Database.executeBatch(mbcCon,1);
        Test.stopTest();
    }
}


And I'm getting this error:

System.QueryException: List has no rows for assignment to SObject

I suppose this is because tfCustom.Id is empty but why is doesn't have any value?

Thanks in advance

I want to improve my Apex coding skills, other than Trail Head can anyone reccomend some good courses?

Thanks,

Robert

 

 

Hello, I have this class that is excecuted by a Batchable

And I getting the following error on the log: FATAL_ERROR System.LimitException: Too many queueable jobs added to the queue: 2

According to some posts that I've read, the issue is because I have system.enqueueJob(dvssService) inside a for loop.
 
public without sharing class OpportunityUpdate_WithDVSSCaseHelper {
    
    public static void UpdateOpptyStatusForOpptyWithDVSSCases_OnPegaSide(List<Opportunity> newOppty,Map<Id,Opportunity> oldOppty){
      
        Map<String,String> DvssCaseTypes = new Map<String,String>();
        DvssCaseTypes.put('DVSS AM', 'DVSSAM'); 
        DvssCaseTypes.put('DVSS CPE','DVSSCPE');
        DvssCaseTypes.put('DVSS DR','DVSSDR');
        DvssCaseTypes.put('DVSS RFP','DVSSRFP');
    
        List<Id> opptyIds = new List<Id>();
        List<Opportunity> opptiesToUpdateOnPega;       
        for(Opportunity oppty:newOppty){
            
            Opportunity oldOp = oldOppty.get(oppty.Id);
            if(oppty.StageName != oldOp.StageName && (oppty.StageName =='5 Closed Lost' || oppty.StageName =='5 Closed Disqualified' ) ){
                opptyIds.add(oppty.Id);
            }
            
        }   
        
        
        if(opptyIds.size() > 0){
            
            
            opptiesToUpdateOnPega = [select Id,StageName,(SELECT Case_Type__c,SWAP_Case_ID__c FROM SWAPS_Tracker__r where case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) 
                                     from Opportunity where Id in:opptyIds and Id in(select Opportunity_Name__c from SWAP_Tracker__c
                                                                                     where Opportunity_Name__c in:opptyIds and case_type__c in ('DVSS AM','DVSS CPE','DVSS DR','DVSS RFP')) ];

            
            if(opptiesToUpdateOnPega.size() > 0){
             
                               
                
                for(Opportunity opp:opptiesToUpdateOnPega){
                    
                    List<SWAP_Tracker__c> swTrack = opp.SWAPS_Tracker__r;
                    
                    system.debug('Oppt info LP>> ' + opp);
                    DateTime dtvar = null;
                    String Casetype='' ;
                    String CaseId='';
            
                    string OpptyStatus = opp.StageName;
                    
                    
                        for(SWAP_Tracker__c swt:swTrack){
                            
                            Casetype =  (DvssCaseTypes.get(swt.Case_Type__c) == null)?'':DvssCaseTypes.get(swt.Case_Type__c);
                            CaseId = (swt.SWAP_Case_ID__c ==null)?'':swt.SWAP_Case_ID__c;
     
                           
                DVSSOpptyStageUpdateService dvssService = new DVSSOpptyStageUpdateService();
                dvssService.Casetype = Casetype;
                dvssService.CaseId = CaseId;
                dvssService.OpptyStatus = OpptyStatus;
                
                system.enqueueJob(dvssService);                
                
            }  

            
            
        }


        
        
     }


   }

}
        
    public class DVSSOpptyStageUpdateService implements Queueable, Database.AllowsCallouts {
        

        public string Casetype{get;set;}
        public string CaseId{get;set;}
        public string OpptyStatus{get;set;}
        
        
        
        public void execute(QueueableContext context){
            
            

            
            system.debug('LL- Calling to update oppty stage');
            
            try{
                
            
                        Pega_CaseMiddleware.PegaCaseResult pagecaserslt = Pega_CaseMiddleware.UpdateDVSSCases_OpptyStatus(Casetype,CaseId,OpptyStatus);
                        
                        If(pagecaserslt.Error.size()>0){                
                            
                            system.debug('LL- error Message>>> ' + pagecaserslt.Error);
                            
                            
                            
                        }
                        else{
                            
                            system.debug('LL- Success Message>>> ' + pagecaserslt.CaseID);
                            
                        } 
                        
                
                
                
            }
            catch(Exception ex){
                
                system.debug('LL-Errrrror: ' + ex.getMessage()+ ' -- ' + ex.getStackTraceString() + '-- ' + ex.getLineNumber());
                insertLog('outbound', '-1', ex.getMessage()+ ex.getStackTraceString() + ex.getLineNumber(), 'DVSSOpptyStageUpdateService');    
                
            }
            
            
        }
        
        
    }
    
    public static void insertLog(String inboundOutbound, string requestID, string message, string method){
        
        try {
            
            Event_Log__c log = new Event_Log__c();
            
            log.Record_Id__c = requestID;
            log.Operation__c = inboundOutbound;
            log.sObject_Type__c ='SWAP Case';
            log.Message__c = 'pega_salesforce_inbound_outbound';
            log.Line_Number__c = method;
            log.Notes__c = message;
            
            insert log;
            
            
        } catch (Exception ex) {
            System.debug(ex.getMessage());
        }
        
        
    }
    
}
Is there any way to refactor this code?
I tried to create a list and then use it as an argument for the enqueueJob like this:
if(opptiesToUpdateOnPega.size() > 0){
             
                //List to collect the dvssService that are going to be enqueable-.
                List<DVSSOpptyStageUpdateService> dvssServiceLst = new List<DVSSOpptyStageUpdateService>();
                
                for(Opportunity opp:opptiesToUpdateOnPega){
                    
                    List<SWAP_Tracker__c> swTrack = opp.SWAPS_Tracker__r;
                    
                    system.debug('Oppt info LP>> ' + opp);
                    DateTime dtvar = null;
                    String Casetype='' ;
                    String CaseId='';
            
                    string OpptyStatus = opp.StageName;
                    
                    
                        for(SWAP_Tracker__c swt:swTrack){
                            
                            Casetype =  (DvssCaseTypes.get(swt.Case_Type__c) == null)?'':DvssCaseTypes.get(swt.Case_Type__c);
                            CaseId = (swt.SWAP_Case_ID__c ==null)?'':swt.SWAP_Case_ID__c;
     
                           
                DVSSOpptyStageUpdateService dvssService = new DVSSOpptyStageUpdateService();
                dvssService.Casetype = Casetype;
                dvssService.CaseId = CaseId;
                dvssService.OpptyStatus = OpptyStatus;
                
                dvssServiceLst.add(dvssService);
                
            }  

            
        }
        
        //Taking the enqueueJob out of the for loop-.
        system.enqueueJob(dvssServiceLst);


     }

But then I got an error (I can't remember the error exactly and my dev console is acting up so I can't replicate it) that said something like class List<DVSSOpptyStageUpdateService> needs to implemet queueable (I can't remember the error exactly and my dev console is acting up so I can't replicate it)

Any help with this, thank you very much.