Salesforce Commerce Cloud Sequence Numbers: A Complete Guide


Introduction

Sequence numbers play a significant role in customer and order management in Salesforce Commerce Cloud (SFCC). Each object is assigned a unique number to identify and track individual records throughout the system. Orders are linked to registered customers using customer sequence numbers, creating a cohesive relationship between customer data and transaction history.

Order numbers are particularly crucial for integrations with external systems such as Order Management Systems (OMS), payment gateways, order processing workflows, and customer support platforms. Since sequence numbers can be customized for different instances, they become invaluable for identifying whether a customer or order originates from Sandbox, Development, Staging, or Production environments.

Beyond orders and customers, sequence numbers are also configured for gift certificate numbers, shipments, and invoices, ensuring consistent identification across all Commerce Cloud business objects.

Table of Contents

What is a Sequence Number?

A sequence number in SFCC is a unique identifier automatically generated by the platform for various business objects. These numbers serve as primary identifiers that maintain data integrity and enable seamless tracking across different systems and processes.

Key characteristics of sequence numbers include:

  • Uniqueness: Each number is guaranteed to be unique within its configured scope
  • Incremental nature: Numbers are generated in sequential order based on configuration
  • Customizable format: Supports prefixes, suffixes, and specific digit formatting
  • System-generated: Automatically assigned by SFCC to ensure consistency and prevent conflicts

Supported Features and Configuration Levels

SFCC provides sequence number configuration for the following business objects:

  • Customer numbers
  • Order numbers
  • Invoice numbers
  • Shipment numbers
  • Gift certificate numbers

Configuration Levels

Sequence numbers are configured in SFCC using two distinct approaches:

Organization Level Configuration

  • The sequence number is unique across all sites within the organization
  • Sequence numbers used in one site will never be assigned to any other site in the organization
  • Provides global uniqueness across the entire Commerce Cloud instance
  • Ideal for organizations requiring centralized number management

Site Level Configuration

  • The sequence number is unique only within the specific site
  • If multiple sites use the same sequence number format, they may have identical numbers assigned to different customers and orders
  • Provides site-specific control over numbering schemes
  • Suitable for organizations with independent site operations

Default Behavior: When you create a new site, the customer list sequence number is set to unique for organization level by default.

Configuration Process

Organization Level Configuration

Navigation Path: Administration > Global Preferences > Sequence Numbers

Sequence number preferences in Administration BM

Sequence number preferences in Administration BM (Image by author)

Organization configuration in BM

Organization configuration in BM (Image by author)

Configurable Sequence Numbers

  • Customer number
  • Order number
  • Invoice number
  • Shipment number
  • Gift certificate number

Customer List Configuration

Navigation Path: Administration > Sites > Customer Lists

Customer List menu in Administration BM

Customer List menu in Administration BM (Image by Author)

Customer list settings in BM

Customer list settings in BM (Image by Author)

Site Level Configuration

Navigation Path: Select your site > Merchant Tools > Site Preferences > Sequence Numbers

Sequence number preferences in BM

Sequence number preferences in BM (Image by Author)

Site level sequence number setup in BM

Site level sequence number setup in BM (Image by Author)

Configurable Sequence Numbers:

  • Order numbers
  • Invoice number
  • Shipment number
  • Gift certificate number

Customer List Considerations

When configuring sequence numbers, consider the following:

  • Consult with the business team regarding potential future customer list mergers
  • Site-specific sequence numbers may cause complications if customer lists are merged later
  • Organization-level numbering provides better flexibility for future data consolidation

Sequence Number Calculation and Format

Format Structure

The generated sequence follows this format pattern:

<prefix>{0,number,00000000}<suffix>

Components Explained:

  • Prefix: Static text that remains constant for all sequence numbers
  • Suffix: Static text appended to the end of each sequence number
  • Initial 0: Indicates the sequence number will start from 0
  • Eight zeros (00000000): Specifies that the generated sequence number will contain 8 digits total

Example: If configured with prefix “ORD-” and suffix “-PROD”, an order number might appear as: ORD-00000123-PROD

Technical Implementation and Generation

SFCC generates sequence numbers based on the configurations uniquely and efficiently. The platform employs several mechanisms to ensure reliability:

Concurrent User Handling

SFCC ensures that sequence numbers cannot be repeated, especially during peak times when multiple users are registering or placing orders simultaneously. The system uses database-level locking mechanisms to prevent conflicts and maintain sequence integrity.

Block Reservation System

To optimize performance and handle high-volume transactions, SFCC employs a block reservation system for sequence number generation.

Important Sequence Behavior

The generated number can be higher or lower than the previously visible number in Business Manager. Therefore, sorting data by sequence number does not guarantee that creation occurred in the same chronological order.

Troubleshooting: Understanding Sequence Number Gaps

Why Gaps Occur in Order Sequences

You may notice gaps in generated sequence numbers for orders. This occurs due to several factors:

Block Reservation Mechanism

  • SFCC reserves blocks of 100 numbers at a time
  • Unused numbers from a block are replaced with the next 100-number block during order creation
  • This optimization reduces database calls but can create gaps in the sequence

Cart Abandonment/Payment fail to Process Impact

  • Every cart transaction receives a sequence number assignment
  • When users abandon carts or payments fail to process, the assigned order number is not reused
  • These abandoned numbers create permanent gaps in the sequence

Replication Considerations

Critical Note: Sequence numbers are not replicated as part of standard data replication processes. This means:

  • You must manually configure sequence numbers on each instance where you enable your site.
  • Configuration changes made in one environment will not automatically propagate to others.
  • Maintain consistent documentation of sequence number configurations across environments.

Custom Sequence Number Tools: Possibilities and Considerations

While SFCC provides robust built-in sequence number generation, there may be scenarios where custom sequence number generators could be beneficial:

Potential Use Cases

  • Complex business logic requiring non-standard numbering schemes
  • Integration with external systems requiring specific number formats
  • Advanced analytics or reporting requirements

Implementation Approaches

Custom sequence number tools could be developed using:

  • SFCC’s Script API for server-side customization
  • Integration with external systems via APIs
  • Custom job-based number generation for batch processes

Pros and Cons

Advantages of Custom Tools:

  • Complete control over numbering logic
  • Integration with external business rules
  • Specialized formatting capabilities

Disadvantages of Custom Tools:

  • Increased complexity and maintenance overhead
  • Potential performance impacts
  • Risk of conflicts with platform-generated numbers
  • Additional testing and quality assurance requirements

Pre-Configuration Considerations

Customer List Planning

  • Business Alignment: Check with the business team regarding the possibility of future customer list mergers
  • Scope Decision: Determine whether site-wise unique numbers or organization-level uniqueness better serves business needs
  • Future Flexibility: Consider how numbering decisions will impact future system integrations or data migrations

Order List Integration

  • External System Compatibility: If integrating with external OMS systems, verify the order number formats they can accept
  • Character Limits: Ensure external systems can handle the full length of configured sequence numbers including prefixes and suffixes
  • Format Requirements: Some systems may require specific number formats or character sets

Best Practices

Configuration Recommendations

  • Use organization-level sequence numbers when possible to maintain global uniqueness
  • Implement meaningful prefixes to identify the source environment (DEV-, STG-, PROD-)
  • Plan for sufficient digit capacity to accommodate future growth
  • Document all sequence number configurations across environments

Performance Optimization

  • Monitor sequence number generation performance during peak traffic periods
  • Consider the impact of complex prefixes or suffixes on system performance
  • Regularly review and optimize sequence number configurations

Monitoring and Auditing

  • Establish monitoring for sequence number gaps and anomalies
  • Maintain logs of sequence number configuration changes
  • Implement alerts for unusual sequence number generation patterns

Global Commerce Considerations

  • Account for different numbering conventions across regions
  • Consider timezone impacts on sequence number generation
  • Plan for localization requirements in international deployments

Conclusion

Sequence numbers are a fundamental component of Salesforce Commerce Cloud’s data management strategy, providing unique identification for critical business objects including customers, orders, invoices, shipments, and gift certificates. Understanding the configuration options, technical implementation, and potential challenges associated with sequence numbers is essential for successful Commerce Cloud deployments.

Proper sequence number configuration ensures seamless integration with external systems, maintains data integrity across environments, and provides the flexibility needed for complex e-commerce operations. By following best practices and carefully planning sequence number strategies, organizations can leverage this powerful feature to support their business objectives while maintaining system reliability and performance.

The choice between organization-level and site-level configuration depends on specific business requirements, but the platform’s robust generation mechanisms ensure that sequence numbers remain unique and reliable regardless of the chosen approach. Regular monitoring, proper documentation, and alignment with business stakeholders will help maintain an effective sequence numbering strategy throughout the lifecycle of your Commerce Cloud implementation.

Reference Materials

Test Your Knowledge!

Note: These questions are generated by AI manually using the content of the blog post.

1. At which level are sequence numbers unique across all sites in an organization by default?

2. What is a primary reason for gaps appearing in order numbers?

Separator