• Dbjensen
  • NEWBIE
  • 255 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 51
    Replies
Hello - I am using flow builder to update a checkbox on an object called Policies__c. The scenario and question is below. Any help would be greatly appreciated. 

1. Get Policies__c WHERE Policies_Started_Today__c = true
Returned records: (List 1)
PCID = A
PCID = B
PCID = C
(PCID is a custom text fiield)

I do a second query: 

2. Get Policies__c WHERE Policies_Started_Today__c = false AND PCID IN List 1
Returned records:
PCID = A
PCID = B

I need to get the record = C and check a box on that record. How can I do this using Flow? 

Thanks for any help you can provide. 

 
I have created a batch class. In the Finish method, I am calling another batch class. I am passing the phone numbers from the first class to the second class using a a set called 'customerPhone '. From what I'm seeing, the second class is not receiving the full list of phone numbers.  

This is the first batch class.

//this set is populated from the execute method. I can see in the logs all phone numbers in the set.
  1. Set<String> customerPhone = new Set<String>();
  2.  
  3. //this is the finish method which I'm passing  in customerPhone   
  4.  public void Finish(Database.BatchableContext bc){
  5.         
  6.         Database.executeBatch(new AddAgentToLeadBatchJob(customerPhone), 200);
  7.     }
Below is the AddAgentToLeadBatchJob class which I am passing in the set 'customerPhone'  from the above class. 
  1.     Set<String> customerPhone = new Set<String>();
  2.     
  3.     //Query leads with matching phone numbers from tethr event
  4.     public Database.QueryLocator start(Database.BatchableContext batchContext){
  5.         
  6.         return Database.getQueryLocator( [SELECT Home_Phone_Removed_Special_Characters__c, Email, Tethr_Agent__c   FROM Lead WHERE Home_Phone_Removed_Special_Characters__c  IN :customerPhone ORDER BY CreatedDate ASC]);        
  7.     }
  8.  
  9. public void execute(Database.BatchableContext batchContext, List<Lead> eventQuery){
  10.  
  11.             System.debug('customerPhone in execute...' +customerPhone.size());                                                      
  12.             
  13.         }
In my test, I am updating 299 records in the first class and passing those phone numbers to the second class. The second class should find 299 matching records. Howevever, the logs show only 99 records are passed to the second batch class. 

Any help would be greatly appreciated. 

Thanks, 
 
I have created a batch class. In the Finish method, I am calling another batch class. Can I pass both a set and map to the second batch class? 

This is the first batch class.
  1. public class AddLeadToCallBatchJob implements Database.Batchable<sObject>, Database.Stateful{ 
  2. Set<String> customerPhone = new Set<String>();
  3. Map<Id, String> agentName = new Map<Id, String>(); 
  4. //this is the finish method which I'm passing  in customerPhone   
  5.  public void Finish(Database.BatchableContext bc){
  6.         
  7.         Database.executeBatch(new AddAgentToLeadBatchJob(customerPhone), 100);
  8.     }

Below is the AddAgentToLeadBatchJob class which I am passing in the set 'customerPhone'  from the above class. How can I pass in the map 'agentName' in addition to the set? (If I create a second constructor, I get an error.)
  1. public class AddAgentToLeadBatchJob  implements Database.Batchable<sObject>, Database.Stateful{
  2.  
  3.     Map<Id, String> agentName = new Map<Id, String>();
  4.     Set<String> customerPhone = new Set<String>();
  5.     
  6.     //constructor
  7.     public AddAgentToLeadBatchJob(Set<String> customerPhone){
  8.         this.customerPhone = customerPhone;
  9.     }
Thanks, 
 
Hello -  I am receiving this error when trying to connect to a second Salesforce org. 
 
System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "SitCopyExternal" might not exist.

I have full CRUD on external credentials. Below is the named credential,  external credentials, and authentication provider. Any idea what's configured incorrectly? 
named credential
External credentials
auth provider
 
Hello- I have not enabled enhanced domains in our production org. However, we already use my.salesforce.com in our integration properties. Will we need to make any changes to this url when I enable enhanced domains?
Hello - I have a for loop that adds a string and Id to a map. This field in the map Field_Agent__r. is a lookup field. The Id keeps coming back as null.

Any idea why? I verified that the Field_Agent__c and User__c is populated. 

Map<String, Id> fieldAgentUserIdMap = new Map<String, Id>(); //Hold Field Agent Username

for(Lead newLead : newlyCreateLeads){
           
                fieldAgentUserIdMap.put(newLead.Field_Agent_SOB__c, newLead.Field_Agent__r.User__c);

        }
        
        System.debug('Field agent in map '+fieldAgentUserIdMap);

DEBUG|Field agent in map {1234567=null}
Hello - I need to test the below query. Is there a way to test for this specific exception in a test class?  'Non-selective query against large object type' 

existingLead = [SELECT Id, street, LastName, PostalCode,                                                                 LastNameStreetAndZipCode__c, Core_Number_Text__c,                                     Status, Home_Phone__c, CreatedDate, Core_Number__c,                                   Policy_Core_Number__c, Lead_Type__c
                                FROM LEAD
                                WHERE ((LastNameStreetAndZipCode__c IN                                                                            :lastNameStreetZipSet  
                                AND Core_Number__c IN :coreNumberTextSet)
                                OR (LastNameStreetAndZipCode__c IN                                                                             :lastNameStreetZipSet)
                                OR (LastNameStreetAndZipCode__c IN :setOfPoBoxes))
                                AND Household__c != null
                                AND Duplicate__c != True
                                AND IsDeleted = False
                                ORDER BY CreatedDate ASC
                                LIMIT 20000];
Hello - How can I run local tests in Microsoft Visual Studio without deploying a package? 

I use this command to deploy: sfdx force:source:deploy -x package -l RunLocalTests  but am looking for a way to run the local tests without deploying the package. 
 
Hello - Below is a soql query I'm using to retrieve leads and a For Loop to update the lead. I'm finding that the For Loop selects a record at random. Sometimes the For Loop updates the oldest lead and sometimes the newest lead. Is there any logic to the record returned by the For Loop if no index is specified? 
 
existingLead = [SELECT Id, street, LastName, PostalCode, 
           LastNameStreetAndZipCode__c, Core_Number_Text__c, Status, Home_Phone__c,
           CreatedDate, Core_Number__c, Policy_Core_Number__c, Lead_Type__c 
                                FROM LEAD 
                                WHERE  (
                                    Policy_Core_Number__c IN :coreNumberTextSet OR
                                    Core_Number__c IN :coreNumberTextSet
                                    OR ( LastNameStreetAndZipCode__c IN :lastNameStreetZipSet
                                        AND Core_Number__c NOT IN :coreNumberTextSet)
                                    OR (LastNameStreetAndZipCode__c IN :setOfPoBoxes
                                        AND Core_Number__c NOT IN :coreNumberTextSet))
                                AND Household__c != null
                                AND Duplicate__c != True
                                AND IsDeleted = False
                                ORDER BY CreatedDate ASC
                                LIMIT 20000];

 
if(existingLead.size() > 0){
                for(Lead leadsToAddToMap : existingLead) {
                    mapOfCoreNumbers.put(leadsToAddToMap.Core_Number__c, 
                              leadsToAddToMap.Core_Number__c);
                   
                    mapOfCreatedDate.put(leadsToAddToMap.LastNameStreetAndZipCode__c, 
                        leadsToAddToMap.CreatedDate);
                }
            }
Hello - How can I prevent this query from returning results if there is no child lead?  In other words, I just want the qurey to return the contact if it has a child lead record. 
User-added image
 
for(Contact contactQueryList : [SELECT ID, (SELECT Id FROM Leads__r) FROM Contact WHERE ID IN :contactsIds]){
            contactQueryList.Contact_Sync_to_Marketing_Cloud__c = true;
             System.debug('contact found '+contactQueryList);
                updateContactList.add(contactQueryList);
        }
Thanks for any help you can provide. 
 
Hello - I need to deploy a class to a sandbox and need to run local tests. How can I run local tests using Microsoft Visual Studio? 

User-added image

 
Hello - I have a very simple web service class that receives a Contact list. When I generate a WSDL file, it's too large to upload. 

Is there a way to create a smaller WSDL file for a list? 
webservice static string createContactRecord(List<Contact> contactArray){
        
        List<Contact> insertContactList = new List<Contact>();
        for(Contact ct : contactArray){
            insertContactList.add(ct);
        }
        insert insertContactList;
        
        return 'Success';
    }

However, if I pass in strings, the WSDL it's not large. 
Webservice static string createContactRecord (String FirstName, String LastName, String Company){

        Contact ct = new Contact();
        ct.FirstName = FirstName;
        ct.LastName = LastName;
        ct.Company = Company;
        insert ct;
        
        return 'Success';

    }



 
Hello - I have a webservice class that creates Accounts and Contacts. I am testing using Postman. When I include both Accounts and Contacts in a payload, I get the error message 'Only one operation within the same request is allowed.' 

Does this mean I can only include one object in a payload? 
 
<tes:inputAccount>
          <tes:accountArray>                                     <tes:Name>Charles</tes:Name>                              <tes:BillingStreet>121 Test RD</tes:BillingStreet>   ​                                   <tes:BillingCity>PHOENIX</tes:BillingCity>​                                  <tes:BillingState>AZ</tes:BillingState>​                                <tes:BillingPostalCode>65906</tes:BillingPostalCode> 
          </tes:accountArray>
      </tes:inputAccount>


<tes:inputContact>
          <tes:contactArray>
                                           <tes:FirstName>Ray</tes:FirstName>                               <tes:LastName>Charles</tes:LastName>                                       <tes:MailingStreet>121 Test RD</tes:MailingStreet>                                        <tes:MailingCity>PHOENIX</tes:MailingCity>                                 <tes:MailingState>AZ</tes:MailingState>                                 <tes:MailingPostalCode>60906</tes:MailingPostalCode> 
         </tes:contactArray>
      </tes:inputContact>

 
Hello - I need to set the LastModifiedDate in a test class to yesterday. The code below sets the created date to yesterday but the LastModifiedDate is still coming back as the current date/time. Any help would be appreciated. 

USER_DEBUG [452]|DEBUG|last modified date (Lead:{Id=00Q7j000002lrl2EAA, CreatedDate=2021-02-03 22:27:47, LastModifiedDate=2021-02-04 22:27:46}, Lead:{Id=00Q7j000002lrl3EAA, CreatedDate=2021-02-03 22:27:47, LastModifiedDate=2021-02-04 22:27:47})
 
        Datetime yesterday = Datetime.now().addDays(-1);
        Test.setCreatedDate(testLeadTwo.Id, yesterday);
        Test.setCreatedDate(testLeadOne.Id, yesterday);
        Test.startTest();
            Database.executeBatch(new SfToPcRetryUpdateRecords_BatchProcess());
        DateTime x5Min = System.now().addMinutes(-5);
            List<Lead> ldCreated = [SELECT ID, CreatedDate, lastmodifieddate FROM Lead WHERE 
                              lastmodifieddate >= LAST_N_DAYS:1 AND lastmodifieddate < :x5Min];
            System.debug('last modified date '+ldCreated);
        Test.stopTest();
 
Hello - I need help adding Account Ids to Contacts. I tried using a map but I don't have any matching keySet that will return the Id. Can I add the Ids to a list and then assign the Id from the list to a updateCt.AccountId?  If so, how can I do this without writing a different class?
 
//Query newly created Account
       List <Account> insertedAcct = [SELECT Id FROM Account WHERE Id =:insertAccounts];

//Query contact that needs the new Account Id 
        List <Contact> indClientIdList = [SELECT Id, AccountId FROM Contact WHERE Id = :clientIdList];
        
        if(indClientIdList.size() > 0){
            for(Contact updateCT : indClientIdList){
                updateCt.AccountId =   NEW ACCOUNT Id HERE );
            }
        }



 
Hello - Hoping to get help with this query. When a lead is created and if it has either a Core number or a PC Account Id number, I look for an account with that matching core number or pc Id. 

The problem with this query is, if a lead had a core number but no pc id, the query returns a non matching account because it returns any account that has no pc id. 

Do I need 2 different queries? One that looks for Core Number and another that looks for PC ID?

acctList = [SELECT Id, Core_Number__c, PC_Account_Id__c FROM Account WHERE Core_Number__c = :coreNumberTextList 
                            OR PC_Account_Id__c = :pcAccountIdList LIMIT 1];
Hello - I am using the Query Plan Tool to see if a formula field qualifies for indexing. The formula field is called FirstLastNameStreetAndZipCode__c and is on the contact object. 

I'm using this query to get the cost:

SELECT Id FROM Contact WHERE FirstLastNameStreetAndZipCode__c = 'Jensen43289874'   

In production, I get a cost of 0.0 but in the sandbox I'm getting 2.8. Is this the correct query to use to test formula fields for indexing? 

User-added image
Hello -I have a soql query that searches for tasks created in the last 7 days that are related to leads created today.

sssTask = [SELECT Id, Owner.Name, WhoId FROM Task 
                       WHERE WhoId != null
                       AND qbdialer__Call_Date_Time__c = Last_N_Days:7
                       AND WhoId IN :leadIds
                       ORDER BY CreatedDate DESC];

A lead may have more than 1 task. I need to add only the most recently created task to a new list for each lead created today. 

List<Task> recentlyCreated = new List<Task>();

Any assistance would be greatly appreciated. 
Hello all - I'm trying to use containsAll() but it is returning false (bullet point 3). Below is a pic of the debug log which shows the states from the set. Any help would be greatly apprceciated. 

1. I'm retrieving field values from a text area field called 'States' on a custom setting object and adding the states to a Set. (the custom settings is a list)

        //Get states from custom settings field and add to set
        Set<String> gwStates = new Set<String>();
        
        for(GW_States__c gwSts : GW_States__c.getAll().values()){
            if(gwSts.States__c != null){
                gwStates.add(gwSts.States__c);
            }
        }
        
        System.debug('States in Set ' +gwStates);

2. Then I query a custom object called Association and add the Association's state to a set and a map. 

        //map/set of states from association
        Map<Id, String> assocState = new Map<Id, String>();
        Set<String> stateSet = new Set<String>();
        
        if(assoc.size() > 0 ){
            for(Association__c associt : assoc){
            assocState.put(associt.Id, associt.Association_State_Province__c);
            stateSet.add(associt.Association_State_Province__c);
            }
        }

            System.debug('State in set from association ' + stateSet);
            System.debug('State in map ' +assocState);

3. Now I'm checking to see if the Association state is contained in the gwStates set and the map. Both return false. (see debug log)

//Use compare method to check for matching states
                Boolean state = gwStates.contains(assocState.get(assocEvent.WhatId));
                Boolean statezSetcompare = gwStates.containsAll(stateSet);
                    system.debug('state compare from map = ' +state);
                system.debug('state compare from Assoc set = ' +statezSetcompare);

User-added image
Hello - Hoping someone can help out with a validation rule that's not working in flow. I have a screen elment with a text field called "Last_Name_1" and a text field called "Phone_1". If the last name is not blank, there must be a phone number. I cannot get the vaidation rule to fire. I tested the same validation rule on the object fields and it works as expected. Below is my validation rule.  

AND(
NOT(ISBLANK({!Last_Name_1})),
ISBLANK({!Phone_1}))

User-added image

 
Hello - I am using flow builder to update a checkbox on an object called Policies__c. The scenario and question is below. Any help would be greatly appreciated. 

1. Get Policies__c WHERE Policies_Started_Today__c = true
Returned records: (List 1)
PCID = A
PCID = B
PCID = C
(PCID is a custom text fiield)

I do a second query: 

2. Get Policies__c WHERE Policies_Started_Today__c = false AND PCID IN List 1
Returned records:
PCID = A
PCID = B

I need to get the record = C and check a box on that record. How can I do this using Flow? 

Thanks for any help you can provide. 

 
I have created a batch class. In the Finish method, I am calling another batch class. I am passing the phone numbers from the first class to the second class using a a set called 'customerPhone '. From what I'm seeing, the second class is not receiving the full list of phone numbers.  

This is the first batch class.

//this set is populated from the execute method. I can see in the logs all phone numbers in the set.
  1. Set<String> customerPhone = new Set<String>();
  2.  
  3. //this is the finish method which I'm passing  in customerPhone   
  4.  public void Finish(Database.BatchableContext bc){
  5.         
  6.         Database.executeBatch(new AddAgentToLeadBatchJob(customerPhone), 200);
  7.     }
Below is the AddAgentToLeadBatchJob class which I am passing in the set 'customerPhone'  from the above class. 
  1.     Set<String> customerPhone = new Set<String>();
  2.     
  3.     //Query leads with matching phone numbers from tethr event
  4.     public Database.QueryLocator start(Database.BatchableContext batchContext){
  5.         
  6.         return Database.getQueryLocator( [SELECT Home_Phone_Removed_Special_Characters__c, Email, Tethr_Agent__c   FROM Lead WHERE Home_Phone_Removed_Special_Characters__c  IN :customerPhone ORDER BY CreatedDate ASC]);        
  7.     }
  8.  
  9. public void execute(Database.BatchableContext batchContext, List<Lead> eventQuery){
  10.  
  11.             System.debug('customerPhone in execute...' +customerPhone.size());                                                      
  12.             
  13.         }
In my test, I am updating 299 records in the first class and passing those phone numbers to the second class. The second class should find 299 matching records. Howevever, the logs show only 99 records are passed to the second batch class. 

Any help would be greatly appreciated. 

Thanks, 
 
I have created a batch class. In the Finish method, I am calling another batch class. Can I pass both a set and map to the second batch class? 

This is the first batch class.
  1. public class AddLeadToCallBatchJob implements Database.Batchable<sObject>, Database.Stateful{ 
  2. Set<String> customerPhone = new Set<String>();
  3. Map<Id, String> agentName = new Map<Id, String>(); 
  4. //this is the finish method which I'm passing  in customerPhone   
  5.  public void Finish(Database.BatchableContext bc){
  6.         
  7.         Database.executeBatch(new AddAgentToLeadBatchJob(customerPhone), 100);
  8.     }

Below is the AddAgentToLeadBatchJob class which I am passing in the set 'customerPhone'  from the above class. How can I pass in the map 'agentName' in addition to the set? (If I create a second constructor, I get an error.)
  1. public class AddAgentToLeadBatchJob  implements Database.Batchable<sObject>, Database.Stateful{
  2.  
  3.     Map<Id, String> agentName = new Map<Id, String>();
  4.     Set<String> customerPhone = new Set<String>();
  5.     
  6.     //constructor
  7.     public AddAgentToLeadBatchJob(Set<String> customerPhone){
  8.         this.customerPhone = customerPhone;
  9.     }
Thanks, 
 
Hello -  I am receiving this error when trying to connect to a second Salesforce org. 
 
System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "SitCopyExternal" might not exist.

I have full CRUD on external credentials. Below is the named credential,  external credentials, and authentication provider. Any idea what's configured incorrectly? 
named credential
External credentials
auth provider
 
Hello- I have not enabled enhanced domains in our production org. However, we already use my.salesforce.com in our integration properties. Will we need to make any changes to this url when I enable enhanced domains?
Hello - I have a for loop that adds a string and Id to a map. This field in the map Field_Agent__r. is a lookup field. The Id keeps coming back as null.

Any idea why? I verified that the Field_Agent__c and User__c is populated. 

Map<String, Id> fieldAgentUserIdMap = new Map<String, Id>(); //Hold Field Agent Username

for(Lead newLead : newlyCreateLeads){
           
                fieldAgentUserIdMap.put(newLead.Field_Agent_SOB__c, newLead.Field_Agent__r.User__c);

        }
        
        System.debug('Field agent in map '+fieldAgentUserIdMap);

DEBUG|Field agent in map {1234567=null}
Hello - How can I run local tests in Microsoft Visual Studio without deploying a package? 

I use this command to deploy: sfdx force:source:deploy -x package -l RunLocalTests  but am looking for a way to run the local tests without deploying the package. 
 
Hello - Below is a soql query I'm using to retrieve leads and a For Loop to update the lead. I'm finding that the For Loop selects a record at random. Sometimes the For Loop updates the oldest lead and sometimes the newest lead. Is there any logic to the record returned by the For Loop if no index is specified? 
 
existingLead = [SELECT Id, street, LastName, PostalCode, 
           LastNameStreetAndZipCode__c, Core_Number_Text__c, Status, Home_Phone__c,
           CreatedDate, Core_Number__c, Policy_Core_Number__c, Lead_Type__c 
                                FROM LEAD 
                                WHERE  (
                                    Policy_Core_Number__c IN :coreNumberTextSet OR
                                    Core_Number__c IN :coreNumberTextSet
                                    OR ( LastNameStreetAndZipCode__c IN :lastNameStreetZipSet
                                        AND Core_Number__c NOT IN :coreNumberTextSet)
                                    OR (LastNameStreetAndZipCode__c IN :setOfPoBoxes
                                        AND Core_Number__c NOT IN :coreNumberTextSet))
                                AND Household__c != null
                                AND Duplicate__c != True
                                AND IsDeleted = False
                                ORDER BY CreatedDate ASC
                                LIMIT 20000];

 
if(existingLead.size() > 0){
                for(Lead leadsToAddToMap : existingLead) {
                    mapOfCoreNumbers.put(leadsToAddToMap.Core_Number__c, 
                              leadsToAddToMap.Core_Number__c);
                   
                    mapOfCreatedDate.put(leadsToAddToMap.LastNameStreetAndZipCode__c, 
                        leadsToAddToMap.CreatedDate);
                }
            }
Hello - How can I prevent this query from returning results if there is no child lead?  In other words, I just want the qurey to return the contact if it has a child lead record. 
User-added image
 
for(Contact contactQueryList : [SELECT ID, (SELECT Id FROM Leads__r) FROM Contact WHERE ID IN :contactsIds]){
            contactQueryList.Contact_Sync_to_Marketing_Cloud__c = true;
             System.debug('contact found '+contactQueryList);
                updateContactList.add(contactQueryList);
        }
Thanks for any help you can provide. 
 
Hello - I need to deploy a class to a sandbox and need to run local tests. How can I run local tests using Microsoft Visual Studio? 

User-added image

 
Hello - I have a very simple web service class that receives a Contact list. When I generate a WSDL file, it's too large to upload. 

Is there a way to create a smaller WSDL file for a list? 
webservice static string createContactRecord(List<Contact> contactArray){
        
        List<Contact> insertContactList = new List<Contact>();
        for(Contact ct : contactArray){
            insertContactList.add(ct);
        }
        insert insertContactList;
        
        return 'Success';
    }

However, if I pass in strings, the WSDL it's not large. 
Webservice static string createContactRecord (String FirstName, String LastName, String Company){

        Contact ct = new Contact();
        ct.FirstName = FirstName;
        ct.LastName = LastName;
        ct.Company = Company;
        insert ct;
        
        return 'Success';

    }



 
Hello - I have a webservice class that creates Accounts and Contacts. I am testing using Postman. When I include both Accounts and Contacts in a payload, I get the error message 'Only one operation within the same request is allowed.' 

Does this mean I can only include one object in a payload? 
 
<tes:inputAccount>
          <tes:accountArray>                                     <tes:Name>Charles</tes:Name>                              <tes:BillingStreet>121 Test RD</tes:BillingStreet>   ​                                   <tes:BillingCity>PHOENIX</tes:BillingCity>​                                  <tes:BillingState>AZ</tes:BillingState>​                                <tes:BillingPostalCode>65906</tes:BillingPostalCode> 
          </tes:accountArray>
      </tes:inputAccount>


<tes:inputContact>
          <tes:contactArray>
                                           <tes:FirstName>Ray</tes:FirstName>                               <tes:LastName>Charles</tes:LastName>                                       <tes:MailingStreet>121 Test RD</tes:MailingStreet>                                        <tes:MailingCity>PHOENIX</tes:MailingCity>                                 <tes:MailingState>AZ</tes:MailingState>                                 <tes:MailingPostalCode>60906</tes:MailingPostalCode> 
         </tes:contactArray>
      </tes:inputContact>

 
Hello - I need to set the LastModifiedDate in a test class to yesterday. The code below sets the created date to yesterday but the LastModifiedDate is still coming back as the current date/time. Any help would be appreciated. 

USER_DEBUG [452]|DEBUG|last modified date (Lead:{Id=00Q7j000002lrl2EAA, CreatedDate=2021-02-03 22:27:47, LastModifiedDate=2021-02-04 22:27:46}, Lead:{Id=00Q7j000002lrl3EAA, CreatedDate=2021-02-03 22:27:47, LastModifiedDate=2021-02-04 22:27:47})
 
        Datetime yesterday = Datetime.now().addDays(-1);
        Test.setCreatedDate(testLeadTwo.Id, yesterday);
        Test.setCreatedDate(testLeadOne.Id, yesterday);
        Test.startTest();
            Database.executeBatch(new SfToPcRetryUpdateRecords_BatchProcess());
        DateTime x5Min = System.now().addMinutes(-5);
            List<Lead> ldCreated = [SELECT ID, CreatedDate, lastmodifieddate FROM Lead WHERE 
                              lastmodifieddate >= LAST_N_DAYS:1 AND lastmodifieddate < :x5Min];
            System.debug('last modified date '+ldCreated);
        Test.stopTest();
 
Hello - I need help adding Account Ids to Contacts. I tried using a map but I don't have any matching keySet that will return the Id. Can I add the Ids to a list and then assign the Id from the list to a updateCt.AccountId?  If so, how can I do this without writing a different class?
 
//Query newly created Account
       List <Account> insertedAcct = [SELECT Id FROM Account WHERE Id =:insertAccounts];

//Query contact that needs the new Account Id 
        List <Contact> indClientIdList = [SELECT Id, AccountId FROM Contact WHERE Id = :clientIdList];
        
        if(indClientIdList.size() > 0){
            for(Contact updateCT : indClientIdList){
                updateCt.AccountId =   NEW ACCOUNT Id HERE );
            }
        }



 
Hello - Hoping to get help with this query. When a lead is created and if it has either a Core number or a PC Account Id number, I look for an account with that matching core number or pc Id. 

The problem with this query is, if a lead had a core number but no pc id, the query returns a non matching account because it returns any account that has no pc id. 

Do I need 2 different queries? One that looks for Core Number and another that looks for PC ID?

acctList = [SELECT Id, Core_Number__c, PC_Account_Id__c FROM Account WHERE Core_Number__c = :coreNumberTextList 
                            OR PC_Account_Id__c = :pcAccountIdList LIMIT 1];