1

I am trying to call a custom method called addColdCustomerToList from execute method, is that something that can be done inside a batch class.
global Database.QueryLocator start(Database.BatchableContext BC) {

}   

global void execute(Database.BatchableContext BC, List<sumchans__MDU_Squad_Raw_Data__c> rawData) {        

}

public void addColdCustomerToList(String fullAddress, String suiteNumber, String givenName, String surname,String telephoneNumber, String internetOffering, String videoOffering, String phoneOffering) {        
    sumchans__Address_ColdCustomers__c coldCustomer = new sumchans__Address_ColdCustomers__c(); // Tracking cold customers of this address.
    coldCustomer.Name = fullAddress;
}

global void finish(Database.BatchableContext BC) {

}

After the edits: I am getting these 2 errors when saving this code

1. Method does not exist or incorrect signature: void addColdCustomerToList(String, String, String, String) from the type sumchans.MDUSquadAddressDataSummarizer

2. Invalid constructor name: addColdCustomerToList

    global Database.QueryLocator start(Database.BatchableContext BC) {
      return Database.getQueryLocator('SELECT sumchans__Street_Address__c,sumchans__City_Name__c FROM sumchans__MDU_Squad_Raw_Data__c');
}
global void execute(Database.BatchableContext BC, List<sumchans__MDU_Squad_Raw_Data__c> rawData) {        
     addColdCustomerToList(fullAddress,rawStats.sumchans__SUITE_NUM__c,rawStats.sumchans__GIVEN_NAME__c,rawStats.sumchans__SURNAME__c);           
}
public addColdCustomerToList(String fullAddress, String suiteNumber, String givenName, String surname) {        
     sumchans__Address_ColdCustomers__c coldCustomer = new sumchans__Address_ColdCustomers__c();
     coldCustomer.Name = fullAddress;
     coldCustomer.sumchans__ADDRESS_MASTER_EXT_ID__r = new sumchans__Address_Master__c(sumchans__Full_Address_Ext_Id__c = fullAddress);
     coldCustomer.sumchans__Suite_Number__c = suiteNumber;
     coldCustomer.sumchans__Full_Name__c = (((givenName).toLowerCase()).capitalize()) +' '+ (((surname).toLowerCase()).capitalize());
     addressColdCustomers.add(coldCustomer); 
}

Thank you all for the continued support.

1 Answer 1

1

You're missing a return type on addColdCustomerToList. Add void, for example.

Also, addressColdCustomers is undefined. You should give us complete code... it feels you're missing a lot here

4
  • Thanks @sebastian, I edited my original post, I am those errors mentioned. Not usre what I did wrong.
    – sumchans
    Commented Mar 27, 2020 at 21:30
  • You edited your question in a way that my answer no longer makes sense. That's not really best practice to collaborate on this site. If you have new questions, please open a new record... Otherwise, the answers you get look completely disconnected from what you're really asking Commented Mar 27, 2020 at 21:35
  • 1
    I've reformatted my answer to properly address what you are now asking Commented Mar 27, 2020 at 21:36
  • I am sorry about that @Sebastian, I have added the code on my initial post back here, just as you said to feel connected. Let me know if that works. Thanks again
    – sumchans
    Commented Mar 27, 2020 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .