State and Country/Territory picklist Metadata
ss_MetaRegion extracts the organisation’s configured State and Country/Territory picklists using the Salesforce Metadata API, returning the full definition of countries and states, including inactive values, visibility settings, default flags, and the hierarchical relationship between countries and their associated states.
This provides a complete, view of geographic configuration within the org, making it particularly useful for data standardisation, validation, and replication scenarios where understanding the full set of allowed (and disallowed) region values is required.
Results are loaded to table ss_SysRegion
Parameters
Parameter | Purpose |
@Env | SQL Sales Environment Name, see Setup |
@Special1 | Future use, not currently used |
@Special2 | Future use, not currently used |
Example of Use
exec ss_MetaRegion 'UAT', 'All'
Note, for larger Orgs, running with the All switch can take some time (upwards of 30+mins), it is recommended to run in a scheduled process/job overnight for example, or simply pulling individual objects on demand or as part of a custom process consolidating subsets of Objects, as needed.
SQL-SALES ss_SysRegion run date: 2026-04-09 ----------------------
20:59:47: v26.2.0.1 Copyright c 2026 SQL-Sales Ltd
20:59:47: Using Env|Schema: uat|dbo
20:59:47: Starting ss_SysRegion retrieval
20:59:49: Connection with Username/Password/ST (BULK & REST API)
20:59:49: Drop existing ss_SysRegion if exists and recreate
20:59:51: Load to dbo.ss_SysRegion
-----------------------------------------------------------------
ss_SysRegion table
CountryISOCode (The ISO code for the country, used internally and for integrations)
CountryLabel (The display name of the country as shown to users)
CountryIntegrationValue (The integration value used when mapping external data to Salesforce)
CountryActive (Indicates whether the country is enabled for use in the org)
CountryVisible (Indicates whether the country is visible/selectable in the UI)
CountryOrgDefault (Indicates whether this is the default country for the org)
CountryStandard (Indicates whether the country is a standard Salesforce-provided value or a custom addition)
StateISOCode (The ISO code for the state/region, used internally and for integrations)
StateLabel (The display name of the state/region as shown to users)
StateIntegrationValue (The integration value used when mapping external data to Salesforce)
StateActive (Indicates whether the state/region is enabled for use)
StateVisible (Indicates whether the state/region is visible/selectable in the UI)
StateStandard (Indicates whether the state/region is a standard Salesforce-provided value or a custom addition)
