0

I want to add a clause in the query locator for billingCountry. enter image description here The commented code runs fine but is there a way to do the same using the NOT IN clause ? I commented line 14,15 and trying to use line 13 instead (in screenshot)

global class UpdateSACustomerCountryBatch implements Database.Batchable{

global String queryBillingCountry;

global UpdateSACustomerCountryBatch(){
    this.queryBillingCountry = 'SELECT Id, Name, BillingCountry, Country_Field__c ' +
        'FROM Account ' +
        'WHERE BillingCountry != null AND Country_Field__c = null AND RecordType.Name = \'Service Account\' ' +
        'AND BillingCountry NOT IN ('Hong Kong','New Caledonia','New Caledonia')'+
    /*  'AND BillingCountry != \'Hong Kong\''+
        'AND BillingCountry != \'New Caledonia\''+ */
        'ORDER BY CreatedDate DESC';
}

global Database.QueryLocator start(Database.BatchableContext BC) { //some code } . . .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.