Source Code Best Practices

Follow these best practices when using source codes.

Education/Documentation

Provide the marketing/merchandising team with a clear understanding of how source code groups have been implemented within the storefront.

Testing Promotions

  • Source code groups should be tested by both the creator and requester.
  • Source code groups should be tested as soon as they go live into production.
  • Maintain a main list of campaign/promotion/source code group assignments.

Implement and Document the Source Code Workflow

Develop a workflow for the build, review and release of source code groups:

  • Identify clear roles and responsibilities related to source code groups within your organization.
  • How are requests for additional source code groups made?
  • What signatures are required, at which steps?
  • What are the specific timelines and deadlines?
  • Who is creating source code groups?
  • Who is managing source code groups once they go live?

Incremental Imports of Source Code Groups

Salesforce B2C Commerce supports incremental updates to the set of source code groups. This functionality is useful in cases where source code groups are provided in chunks by external systems and must be imported into B2C Commerce.

Staging

Import source code groups and their codes into Staging, test them in Staging, replicate and test in Development, and then replicate them to Production.

Using a Source Code Pattern

Do your source codes follow a pattern? If you need more then 100 source codes per source code group, we recommend that you use a source code pattern instead of individual source codes.

A source code group is a group defined by a pattern. When the system processes a source code, If the pattern matches, the source code group is recognized and activated. You don't need to add all source codes explicitly. This should be an exception, rather than the rule, and limited to a few hundred source codes. The source code group pattern is used for recognition, but the actual code is preserved and stored with the session.

Note: If your source codes do not follow a pattern, consider reimplementing your source code solution.
Example

Suppose you have multiple source-codes (and a series of sale catalogs), and one source code is specified for each sale catalog? The storefront encompasses all of these sales catalogs and you want to direct all of the source-codes to one Outlet area of the storefront. You could:

  1. Create a Source-Code Group, for example, SALE to encompass all of the catalogs, with an initial Source-Code specification of SPRING*.
  2. Use the source-code specification of SPRING* to encompass all your source-codes with SPRING in the name, representing all Spring Sale catalogs. For example, SPRINGOUTDOOR, SPRINGHOME, SPRINGWOMENS.
  3. On the Redirects tab, associate the SALE source-code group with the category ID of the Outlet section of your storefront.

    Alternatively, you could create the same SALE Source-Code Group, and within it, create a series of source-code specifications aimed to encompass individual source-codes. For example:

    Source-code group: SALE

    Source-code specifications:
    OUTDOOR[N1..1000], HOME[N1..1000] and WOMENS[N1..1000]

    These encompass source codes OUTDOOR1 through OUTDOOR1000, and so on.