View Categories

Metadata State Country Update

Update State and Country/Territory Picklist Integration Values

ss_MetaRegionUpdate updates the Integration Values of existing Salesforce State and Country/Territory picklist entries using the Salesforce Metadata API.

Changes are supplied through a SQL Server table and processed using either the SQLB (flat-file) or ODBC connection method configured for the SQL-Sales Environment.

Only existing entries can be updated. Creating or deleting countries and states is not supported.

The procedure includes a validation-only option to check proposed changes before applying them to Salesforce.

Parameters

ParameterPurpose
@EnvSQL-Sales Environment Name, see Setup
@TableNameSQL Server table containing the proposed updates
@ValidateOnly1 = Validate only (default), 0 = Apply changes
@Special1Future use, not currently used
@Special2Future use, not currently used

The source table must reside in the same SQL Server schema as the ss_MetaRegionUpdate stored procedure.

Input Table

The input table requires the following columns:

Column NamePurpose
CountryISOCodeISO code identifying the existing country
StateISOCodeISO code identifying the existing state/region; NULL for country-only updates
CountryIntegrationValueNew country integration value; NULL to leave unchanged
StateIntegrationValueNew state/region integration value; NULL to leave unchanged

Only the Integration Value columns are updated. Labels, ISO codes, active/visible flags and other metadata attributes remain unchanged.

Example Input Table

CREATE TABLE dbo.RegionUpdates
(
    CountryISOCode nvarchar(10),
    StateISOCode nvarchar(10),
    CountryIntegrationValue nvarchar(255),
    StateIntegrationValue nvarchar(255)
);

Example updates:

INSERT INTO dbo.RegionUpdates
(
    CountryISOCode,
    StateISOCode,
    CountryIntegrationValue,
    StateIntegrationValue
)
VALUES
('US', 'NY', NULL, 'US-NY'),
('US', 'CA', NULL, 'US-CA');

This requests updates to the Integration Values of New York and California without modifying the country Integration Value.

Example of Use

Validate proposed updates

EXEC dbo.ss_MetaRegionUpdate
    @Env = 'UAT',
    @TableName = 'RegionUpdates',
    @ValidateOnly = 1;
SQL-SALES ss_MetaRegionUpdate run date: 2026-11-11 --------------
20:23:23: v26.4.0.3 Copyright c 2026 SQL-Sales Ltd
20:23:23: Using Env|Schema: UAT|dbo
20:23:26: Connection with OAuth Authentication (ODBC & REST API)
20:23:26: Starting Metadata Region Update (validate only)
20:23:29: Validation Successful
----------------------------------------------------------------- 

Validation checks that the referenced countries and states exist, identifies conflicting updates and checks for duplicate Integration Values.

Apply updates to Salesforce

EXEC dbo.ss_MetaRegionUpdate
    @Env = 'UAT',
    @TableName = 'RegionUpdates',
    @ValidateOnly = 0;
SQL-SALES ss_MetaRegionUpdate run date: 2026-11-11 --------------
20:23:23: v26.4.0.3 Copyright c 2026 SQL-Sales Ltd
20:23:23: Using Env|Schema: UAT|dbo
20:23:26: Connection with OAuth Authentication (ODBC & REST API)
Starting Metadata Region Update (Live)
Load completed successfully
-----------------------------------------------------------------

Changes are submitted using the Salesforce Metadata API and verified by reading the updated configuration.

If no changes are required, the procedure reports:

Load completed (no changes required)

Important Notes

  • Only existing Country/State entries can be modified.
  • NULL Integration Values in the source table indicate no change.
  • Duplicate or conflicting Integration Values are rejected during validation.
  • Validation-only mode does not write to Salesforce.
  • The input SQL Server table is not modified.
  • Updating an Integration Value does not automatically update existing Salesforce records, such as Account or Contact. Any required data alignment must be performed separately.
  • Salesforce Metadata API permissions are required.

The current State and Country/Territory configuration can be retrieved using ss_MetaRegion.

See also: Metadata State Country.