@salesforce/b2c-tooling-sdk / clients / normalizeTenantId
Function: normalizeTenantId()
normalizeTenantId(
value):string
Defined in: packages/b2c-tooling-sdk/src/clients/custom-apis.ts:260
Normalizes any parseable tenant/organization ID form to the canonical underscore format.
Supported input forms (all resolve to abcd_123):
abcd_123— canonical tenant ID (returned as-is)abcd-123— hyphenated tenant IDf_ecom_abcd_123— organization IDf_ecom_abcd-123— org ID with hyphenated tenantabcd-123.dx.commercecloud.salesforce.com— sandbox hostname
Only sandbox hostnames carry the tenant ID by convention. Other hostnames (for example staging-realm-customer.demandware.net) are returned unchanged rather than guessing a tenant from the first label.
Parameters
value
string
The tenant ID, organization ID, or sandbox hostname
Returns
string
The normalized tenant ID in canonical underscore format (e.g., "abcd_123")
Example
ts
normalizeTenantId('f_ecom_zzxy_prd') // Returns 'zzxy_prd'
normalizeTenantId('zzxy-prd') // Returns 'zzxy_prd'
normalizeTenantId('zzxy-001.dx.commercecloud.salesforce.com') // Returns 'zzxy_001'