ERROR: The BillingStateCode field contains Al, which isn't an available state. Your administrator can add it for you., fields [BillingStateCode]".

Issue #1

You see the error message like this:

The BillingStateCode field contains Al, which isn't an available state. Your administrator can add it for you., fields [BillingStateCode]

This error may appear if you enable the country/state picklist in your Salesforce org. This error message means the state defined in Magento doesn't exist in the Salesforce system or has a different state code.

Solution #1: Add this state in your Salesforce org:

  1. From Setup, enter State in the Quick Find box, then select State and Country Picklists.
  2. Click Configure states and countries.
  3. Click New Country to add a country or click Edit for a listed country.
  4. Under Country Information, specify your options.
  5. In the "States" section you can manage existing records or add new one

Issue #2

You see the error message like this:

The BillingStateCode field contains Oslo, which isn't an available state. Your administrator can add it for you., fields [BillingStateCode]

The issue happens because the state is picklist in the Salesforce, but simple text field in your Magento. It means Magento doesn't have information about state code and send the state name to the Salesforce:

Solution #1: disable picklist in the Salesforce

  1. From Setup, enter State in the Quick Find box, then select State and Country Picklists.
  2. Click the Disable button at the bottom of the page
  3. Disable picklist support in our Magneto module: Salesforce → General configuration → State and Country Picklists


Solution #2: create state picklist data in your Magento:

We strongly recommend create database backup before you make any changes!

Check on the staging store copy first!


  1. Prepare SQL script to add necessary states to the directory_country_region and directory_country_region_name  tables. Here is an example for Norway: 

    INSERT INTO `directory_country_region` (`region_id`, `country_id`, `code`, `default_name`) VALUES
    (NULL, 'NO', '01', 'Østfold'),
    (NULL, 'NO', '02', 'Akershus'),
    (NULL, 'NO', '03', 'Oslo'),
    (NULL, 'NO', '04', 'Hedmark'),
    (NULL, 'NO', '05', 'Oppland'),
    (NULL, 'NO', '06', 'Buskerud'),
    (NULL, 'NO', '07', 'Vestfold'),
    (NULL, 'NO', '08', 'Telemark')
    ;
    
    
    INSERT INTO directory_country_region_name( locale, region_id, name )
    SELECT 'en_US' AS "language", region_id, default_name
    FROM `directory_country_region`
    WHERE country_id = 'NO';
    
    INSERT INTO directory_country_region_name( locale, region_id, name )
    SELECT 'en_US' AS "language", region_id, default_name
    FROM `directory_country_region`
    WHERE country_id = 'nb_NO';
    
    INSERT INTO directory_country_region_name( locale, region_id, name )
    SELECT 'en_US' AS "language", region_id, default_name
    FROM `directory_country_region`
    WHERE country_id = 'nn_NO';
  2. Prepare SQL queries to update address tables. Here is an example for Norway country

    UPDATE customer_address_entity
    SET region_id = (SELECT region_id
    FROM directory_country_region
    WHERE directory_country_region.default_name = customer_address_entity.region
    AND directory_country_region.country_id = customer_address_entity.country_id
    )
    WHERE (region_id = 0 or ISNULL(region_id))
    AND country_id = 'NO';
    
    
    UPDATE sales_order_address
    SET region_id = (SELECT region_id
    FROM directory_country_region
    WHERE directory_country_region.default_name = sales_order_address.region
    AND directory_country_region.country_id = sales_order_address.country_id
    )
    WHERE (region_id = 0 or ISNULL(region_id))
    AND country_id = 'NO';
    
    UPDATE quote_address
    SET region_id = (SELECT region_id
    FROM directory_country_region
    WHERE directory_country_region.default_name = quote_address.region
    AND directory_country_region.country_id = quote_address.country_id
    )
    WHERE (region_id = 0 or ISNULL(region_id))
    AND country_id = 'NO';
    
  3. Apply these patches on your staging installation first.

Filter by label

There are no items with the selected labels at this time.