Clean and initialize the environment

Abstract

How to clear out Commerce data in your test or development Commerce environment, and reset default data sets, such as catalog data for example.

You can clean your Commerce Engine environment using the Postman samples provided in the Commerce Engine SDK.

The Clean Environment request takes the current environment as an input parameter, and uses the environment's ArtifactStoreID to match and remove all data in the Shared Environments database associated with that same ID. The ArtifactStoreID is defined in the environment .json file, stored under the c:\inetpub\wwwroot\<Role>\wwwroot\data\Environments folder.

Keep in mind that the database stores all of the commerce data used on the site (for example, catalog data, customer records, pricing information, configured promotions), as well as the generic entities and lists that power the functionality of the various installed plugins.

Any environment data stored in the Global database remains intact.

To clean and initialize the Commerce Engine environment:

  1. In the Postman  Collections pane, expand the SitecoreCommerce_DevOps collection.

  2. Open the 2 Clean Environment folder, and execute the Clean Environment request.

  3. Open the 3 Environment Initialize folder and execute the Ensure\Sync default content paths request.

    Note

    The Ensure\Sync default content path synchronizes all items in the content path. (The default path is /sitecore/Commerce/Commerce Control Panel, as defined in the Commerce.Plugin.Content.DefaultContentPathsPolicy, located in the PlugIn.Content.PolicySet-1.0.0.json file). You can only exercise this request in the context of a clean environment. (To synchronize only a sub-set of new or changed content items, use the sync content item or sync content path samples).

  4. In the same folder, execute the Initialize Environment request.

  5. Open the Sitecore Launchpad in a browser and click on Content Editor.

  6. In the left pane, navigate to the /sitecore/Content/<tenant>/<site>/Home/Catalogs folder.

  7. In the right pane, un-check the Selected Catalog box and save your changes.

  8. Re-check the Selected Catalog box and save your changes again.

  9. Rebuild the Sitecore indexes, as described here.

  10. Republish the site, as described here.