SFCC Business Manager
Overview
Business Manager (BM) is the SFCC administration interface accessed at https://{instance}.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage. It controls every aspect of the SFCC installation: catalog and product management, site preferences, promotion engine, content assets, A/B tests, and job scheduling. Bulk data operations are performed via XML import/export using the Import & Export framework, which processes files from the IMPEX directory via scheduled jobs.
When to Use This Skill
- When performing initial catalog setup for a new SFCC site
- When importing products, prices, or inventory from an ERP or PIM system via XML
- When configuring OCAPI settings for API client registrations
- When setting up site preferences for custom cartridge configurations
- When managing promotions, coupon campaigns, and A/B tests across sites
- When diagnosing job failures or reviewing import error logs in Business Manager
Core Instructions
Navigate key Business Manager areas
Business Manager URLs follow the pattern {instanceUrl}/on/demandware.store/Sites-Site/default/{Controller-Action}:
# Site Selection (global)
/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage
# Catalog Management (site-specific)
/on/demandware.store/Sites-{SiteID}/default/ViewCategories-Start
# Site Preferences
/on/demandware.store/Sites-{SiteID}/default/ViewSitePreference-StartGroups
# OCAPI Settings
/on/demandware.store/Sites-Site/default/ViewApplicationApiSettings-Start
# Import & Export
/on/demandware.store/Sites-{SiteID}/default/ViewJobSchedule-Start
# Job Execution
/on/demandware.store/Sites-Site/default/ViewJobSchedule-Start
Import products via XML catalog import
SFCC catalog XML follows Demandware's catalog.xsd schema. Products are imported as catalog objects:
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="your-catalog">
<!-- Category definition -->
<category category-id="electronics">
<display-name xml:lang="x-default">Electronics</display-name>
<display-name xml:lang="en-US">Electronics</display-name>
<online-flag>true</online-flag>
<parent>root</parent>
</category>
<!-- Simple product -->
<product product-id="PROD-001">
<ean>1234567890123</ean>
<upc>123456789012</upc>
<display-name xml:lang="x-default">Wireless Headphones Pro</display-name>
<display-name xml:lang="en-US">Wireless Headphones Pro</display-name>
<long-description xml:lang="x-default">Premium wireless headphones with ANC</long-description>
<online-flag>true</online-flag>
<available-flag>true</available-flag>
<searchable-flag>true</searchable-flag>
<tax-class-id>standard</tax-class-id>
<brand>AudioPro</brand>
<manufacturer-sku>AP-WH-001</manufacturer-sku>
<classification-category catalog-id="your-catalog">electronics</classification-category>
<images>
<image-group view-type="large">
<image path="products/PROD-001-large.jpg"/>
</image-group>
<image-group view-type="small">
<image path="products/PROD-001-small.jpg"/>
</image-group>
</images>
<custom-attributes>
<custom-attribute attribute-id="color">Black</custom-attribute>
<custom-attribute attribute-id="batteryLife">30</custom-attribute>
</custom-attributes>
</product>
<!-- Variation master product -->
<product product-id="SHIRT-MASTER">
<display-name xml:lang="x-default">Classic Cotton Shirt</display-name>
<online-flag>true</online-flag>
<classification-category catalog-id="your-catalog">apparel</classification-category>
<variations>
<attributes>
<variation-attribute attribute-id="color" variation-attribute-id="color">
<display-name xml:lang="x-default">Color</display-name>
<variation-attribute-values>
<variation-attribute-value value="Blue">
<display-value xml:lang="x-default">Blue</display-value>
</variation-attribute-value>
<variation-attribute-value value="Red">
<display-value xml:lang="x-default">Red</display-value>
</variation-attribute-value>
</variation-attribute-values>
</variation-attribute>
<variation-attribute attribute-id="size" variation-attribute-id="size">
<display-name xml:lang="x-default">Size</display-name>
<variation-attribute-values>
<variation-attribute-value value="S"><display-value xml:lang="x-default">S</display-value></variation-attribute-value>
<variation-attribute-value value="M"><display-value xml:lang="x-default">M</display-value></variation-attribute-value>
<variation-attribute-value value="L"><display-value xml:lang="x-default">L</display-value></variation-attribute-value>
</variation-attribute-values>
</variation-attribute>
</attributes>
<variants>
<variant product-id="SHIRT-BLUE-S"/>
<variant product-id="SHIRT-BLUE-M"/>
<variant product-id="SHIRT-RED-M"/>
</variants>
</variations>
</product>
<!-- Variant products -->
<product product-id="SHIRT-BLUE-S">
<display-name xml:lang="x-default">Classic Cotton Shirt - Blue / S</display-name>
<online-flag>true</online-flag>
<variation-attribute-values>
<variation-attribute-value attribute-id="color">Blue</variation-attribute-value>
<variation-attribute-value attribute-id="size">S</variation-attribute-value>
</variation-attribute-values>
</product>
<!-- Product category assignment -->
<category-assignment category-id="electronics" product-id="PROD-001">
<primary-flag>true</primary-flag>
</category-assignment>
</catalog>
Import inventory and prices
<!-- inventory.xml — import stock levels -->
<?xml version="1.0" encoding="UTF-8"?>
<inventory xmlns="http://www.demandware.com/xml/impex/inventory/2007-05-31">
<inventory-list>
<header list-id="your-inventory-list">
<default-in-stock>false</default-in-stock>
<description>Main Inventory</description>
</header>
<records>
<record product-id="PROD-001">
<allocation>150.00</allocation>
<allocation-timestamp>2026-03-12T00:00:00.000Z</allocation-timestamp>
<perpetual>false</perpetual>
<preorderable>false</preorderable>
<backorderable>false</backorderable>
</record>
<record product-id="SHIRT-BLUE-S">
<allocation>42.00</allocation>
<perpetual>false</perpetual>
</record>
</records>
</inventory-list>
</inventory>
<!-- pricebook.xml — import prices -->
<?xml version="1.0" encoding="UTF-8"?>
<pricebooks xmlns="http://www.demandware.com/xml/impex/pricebook/2006-10-31">
<pricebook>
<header pricebook-id="usd-m-list-prices">
<currency>USD</currency>
<display-name xml:lang="x-default">USD List Prices</display-name>
<online-flag>true</online-flag>
</header>
<price-tables>
<price-table product-id="PROD-001">
<amount quantity="1">149.99</amount>
</price-table>
<price-table product-id="SHIRT-BLUE-S">
<amount quantity="1">39.99</amount>
</price-table>
</price-tables>
</pricebook>
</pricebooks>
Configure site preferences for custom cartridge settings
Site preferences are custom attributes defined in Business Manager → Administration → Site Development → System Object Types → SitePreferences:
<!-- system-objecttype-extensions.xml — define custom site preference -->
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">
<type-extension type-id="SitePreferences">
<custom-attribute-definitions>
<attribute-definition attribute-id="myIntegration_apiEndpoint">
<display-name xml:lang="x-default">My Integration API Endpoint</display-name>
<type>string</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
<min-length>0</min-length>
<max-length>255</max-length>
</attribute-definition>
<attribute-definition attribute-id="myIntegration_enabledFlag">
<display-name xml:lang="x-default">My Integration Enabled</display-name>
<type>boolean</type>
<mandatory-flag>false</mandatory-flag>
</attribute-definition>
</custom-attribute-definitions>
<group-definitions>
<attribute-group group-id="MyIntegration">
<display-name xml:lang="x-default">My Integration Settings</display-name>
<attribute attribute-id="myIntegration_apiEndpoint"/>
<attribute attribute-id="myIntegration_enabledFlag"/>
</attribute-group>
</group-definitions>
</type-extension>
</metadata>
Access in cartridge ISML/controller:
// In SFCC ISML controller (server-side JS)
var Site = require('dw/system/Site');
var currentSite = Site.getCurrent();
var apiEndpoint = currentSite.getCustomPreferenceValue('myIntegration_apiEndpoint');
var isEnabled = currentSite.getCustomPreferenceValue('myIntegration_enabledFlag');
Configure and run import jobs
SFCC import jobs are configured in Business Manager → Administration → Operations → Jobs. Jobs use XML feed files placed in /IMPEX/src/ or uploaded via the Jobs API:
// Upload an XML file to IMPEX via OCAPI WebDAV before triggering job
const importFile = fs.readFileSync('./catalog.xml');
// Upload via WebDAV (SFCC exposes IMPEX as WebDAV)
const webdavUrl = `${instanceUrl}/on/demandware.servlet/webdav/Sites/Impex/src/catalog-import.xml`;
await fetch(webdavUrl, {
method: "PUT",
headers: {
Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString("base64")}`,
"Content-Type": "application/xml",
},
body: importFile,
});
// Trigger the import job via Jobs API
const jobResponse = await fetch(
`${instanceUrl}/s/-/dw/data/v23_2/jobs/sfcc-site-archive-import/executions`,
{
method: "POST",
headers: {
Authorization: `Bearer ${adminToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
parameters: [
{ name: "ImportFile", value: "catalog-import.xml" },
{ name: "catalogID", value: "your-catalog" },
],
}),
}
);
Examples
Export orders for ERP sync
<!-- Order export configuration — Business Manager → Merchant Tools → Site Preferences → Export/Import -->
<!-- Or via OCAPI Data API order search: -->
// Paginated order export via OCAPI Data API
async function exportOrdersSince(sinceDate: string) {
const token = await getAdminToken();
const instanceUrl = process.env.SFCC_INSTANCE_URL!;
const siteId = process.env.SFCC_SITE_ID!;
let start = 0;
const count = 100;
const allOrders = [];
while (true) {
const response = await fetch(
`${instanceUrl}/s/${siteId}/dw/data/v23_2/order_search`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: {
filtered_query: {
query: { match_all_query: {} },
filter: {
range_filter: {
field: "creation_date",
from: sinceDate,
},
},
},
},
select: "(**)",
count,
start,
sorts: [{ field: "creation_date", sort_order: "asc" }],
}),
}
);
const { hits, total } = await response.json();
allOrders.push(...(hits ?? []));
start += count;
if (start >= total) break;
}
return allOrders;
}
Create a promotion via OCAPI
async function createPromotion(promo: {
id: string;
name: string;
discountPercent: number;
startDate: string;
endDate: string;
}) {
const token = await getAdminToken();
const instanceUrl = process.env.SFCC_INSTANCE_URL!;
const siteId = process.env.SFCC_SITE_ID!;
await fetch(
`${instanceUrl}/s/${siteId}/dw/data/v23_2/promotions/${promo.id}`,
{
method: "PUT",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
id: promo.id,
name: { default: promo.name },
enabled: true,
start_date: promo.startDate,
end_date: promo.endDate,
discount: {
type: "percentage",
value: promo.discountPercent,
},
promotion_class: "order",
}),
}
);
}
Best Practices
- Validate XML imports against Demandware schemas before uploading — the XSD files are available in Business Manager under Administration → Site Development → System Object Types; invalid XML fails silently without line-level error messages
- Use unique job IDs for concurrent imports — SFCC jobs are single-threaded per job definition; use multiple job definitions if you need parallel catalog + inventory imports
- Always include
catalog-id in catalog XML — mismatched or missing catalog IDs cause products to import into the wrong catalog or fail completely
- Test imports on staging before production — there is no bulk "undo" for catalog imports; test with a small subset first
- Monitor job logs in BM → Administration → Operations → Jobs — failed jobs log to
/IMPEX/log/; download and review logs immediately after automated imports
- Use
<display-name xml:lang="x-default"> for all localized strings — the x-default locale is required; missing it causes display issues in all locales
- Set site preferences via import XML, not manually — document all custom site preference values in XML files committed to version control for environment consistency
Common Pitfalls
| Problem |
Solution |
| Products imported but not visible in storefront |
Check product online-flag is true, the category assignment has primary-flag set, and the site catalog is assigned to the current site |
| Import job completes but log shows "0 records processed" |
Verify the file was uploaded to the correct IMPEX path and the job's ImportFile parameter matches the exact filename including extension |
| Custom site preference not appearing in BM UI |
Ensure the system-objecttype-extensions.xml has been imported via BM → Administration → Site Development → Import & Export and the cache has been cleared |
| Inventory not updating despite successful import |
Check that the inventory-list list-id in the XML matches the inventory list assigned to the site in BM → Merchant Tools → Products and Catalogs |
| OCAPI Data API returns 403 on job trigger |
The client ID must have Data API permissions for the jobs resource; verify in BM → Administration → Site Development → OCAPI Settings → Data |
| Prices show default catalog price instead of imported pricebook |
Assign the pricebook to the site customer groups in BM → Merchant Tools → Pricing → Pricebooks; imported pricebooks are not active until assigned |
Related Skills
- @sfcc-cartridge-development
- @sfcc-ocapi-scapi
- @catalog-management
- @product-import-export
- @promotion-engine
1---2name: sfcc-business-manager3description: Configure Salesforce Commerce Cloud via Business Manager — manage catalogs, promotions, site preferences, and run XML import/export jobs4---56# SFCC Business Manager78## Overview910Business Manager (BM) is the SFCC administration interface accessed at `https://{instance}.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage`. It controls every aspect of the SFCC installation: catalog and product management, site preferences, promotion engine, content assets, A/B tests, and job scheduling. Bulk data operations are performed via XML import/export using the Import & Export framework, which processes files from the IMPEX directory via scheduled jobs.1112## When to Use This Skill1314- When performing initial catalog setup for a new SFCC site15- When importing products, prices, or inventory from an ERP or PIM system via XML16- When configuring OCAPI settings for API client registrations17- When setting up site preferences for custom cartridge configurations18- When managing promotions, coupon campaigns, and A/B tests across sites19- When diagnosing job failures or reviewing import error logs in Business Manager2021## Core Instructions22231. **Navigate key Business Manager areas**2425 Business Manager URLs follow the pattern `{instanceUrl}/on/demandware.store/Sites-Site/default/{Controller-Action}`:2627 ```28 # Site Selection (global)29 /on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage3031 # Catalog Management (site-specific)32 /on/demandware.store/Sites-{SiteID}/default/ViewCategories-Start3334 # Site Preferences35 /on/demandware.store/Sites-{SiteID}/default/ViewSitePreference-StartGroups3637 # OCAPI Settings38 /on/demandware.store/Sites-Site/default/ViewApplicationApiSettings-Start3940 # Import & Export41 /on/demandware.store/Sites-{SiteID}/default/ViewJobSchedule-Start4243 # Job Execution44 /on/demandware.store/Sites-Site/default/ViewJobSchedule-Start45 ```46472. **Import products via XML catalog import**4849 SFCC catalog XML follows Demandware's `catalog.xsd` schema. Products are imported as catalog objects:5051 ```xml52 <?xml version="1.0" encoding="UTF-8"?>53 <catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="your-catalog">5455 <!-- Category definition -->56 <category category-id="electronics">57 <display-name xml:lang="x-default">Electronics</display-name>58 <display-name xml:lang="en-US">Electronics</display-name>59 <online-flag>true</online-flag>60 <parent>root</parent>61 </category>6263 <!-- Simple product -->64 <product product-id="PROD-001">65 <ean>1234567890123</ean>66 <upc>123456789012</upc>67 <display-name xml:lang="x-default">Wireless Headphones Pro</display-name>68 <display-name xml:lang="en-US">Wireless Headphones Pro</display-name>69 <long-description xml:lang="x-default">Premium wireless headphones with ANC</long-description>70 <online-flag>true</online-flag>71 <available-flag>true</available-flag>72 <searchable-flag>true</searchable-flag>73 <tax-class-id>standard</tax-class-id>74 <brand>AudioPro</brand>75 <manufacturer-sku>AP-WH-001</manufacturer-sku>76 <classification-category catalog-id="your-catalog">electronics</classification-category>77 <images>78 <image-group view-type="large">79 <image path="products/PROD-001-large.jpg"/>80 </image-group>81 <image-group view-type="small">82 <image path="products/PROD-001-small.jpg"/>83 </image-group>84 </images>85 <custom-attributes>86 <custom-attribute attribute-id="color">Black</custom-attribute>87 <custom-attribute attribute-id="batteryLife">30</custom-attribute>88 </custom-attributes>89 </product>9091 <!-- Variation master product -->92 <product product-id="SHIRT-MASTER">93 <display-name xml:lang="x-default">Classic Cotton Shirt</display-name>94 <online-flag>true</online-flag>95 <classification-category catalog-id="your-catalog">apparel</classification-category>96 <variations>97 <attributes>98 <variation-attribute attribute-id="color" variation-attribute-id="color">99 <display-name xml:lang="x-default">Color</display-name>100 <variation-attribute-values>101 <variation-attribute-value value="Blue">102 <display-value xml:lang="x-default">Blue</display-value>103 </variation-attribute-value>104 <variation-attribute-value value="Red">105 <display-value xml:lang="x-default">Red</display-value>106 </variation-attribute-value>107 </variation-attribute-values>108 </variation-attribute>109 <variation-attribute attribute-id="size" variation-attribute-id="size">110 <display-name xml:lang="x-default">Size</display-name>111 <variation-attribute-values>112 <variation-attribute-value value="S"><display-value xml:lang="x-default">S</display-value></variation-attribute-value>113 <variation-attribute-value value="M"><display-value xml:lang="x-default">M</display-value></variation-attribute-value>114 <variation-attribute-value value="L"><display-value xml:lang="x-default">L</display-value></variation-attribute-value>115 </variation-attribute-values>116 </variation-attribute>117 </attributes>118 <variants>119 <variant product-id="SHIRT-BLUE-S"/>120 <variant product-id="SHIRT-BLUE-M"/>121 <variant product-id="SHIRT-RED-M"/>122 </variants>123 </variations>124 </product>125126 <!-- Variant products -->127 <product product-id="SHIRT-BLUE-S">128 <display-name xml:lang="x-default">Classic Cotton Shirt - Blue / S</display-name>129 <online-flag>true</online-flag>130 <variation-attribute-values>131 <variation-attribute-value attribute-id="color">Blue</variation-attribute-value>132 <variation-attribute-value attribute-id="size">S</variation-attribute-value>133 </variation-attribute-values>134 </product>135136 <!-- Product category assignment -->137 <category-assignment category-id="electronics" product-id="PROD-001">138 <primary-flag>true</primary-flag>139 </category-assignment>140 </catalog>141 ```1421433. **Import inventory and prices**144145 ```xml146 <!-- inventory.xml — import stock levels -->147 <?xml version="1.0" encoding="UTF-8"?>148 <inventory xmlns="http://www.demandware.com/xml/impex/inventory/2007-05-31">149 <inventory-list>150 <header list-id="your-inventory-list">151 <default-in-stock>false</default-in-stock>152 <description>Main Inventory</description>153 </header>154 <records>155 <record product-id="PROD-001">156 <allocation>150.00</allocation>157 <allocation-timestamp>2026-03-12T00:00:00.000Z</allocation-timestamp>158 <perpetual>false</perpetual>159 <preorderable>false</preorderable>160 <backorderable>false</backorderable>161 </record>162 <record product-id="SHIRT-BLUE-S">163 <allocation>42.00</allocation>164 <perpetual>false</perpetual>165 </record>166 </records>167 </inventory-list>168 </inventory>169 ```170171 ```xml172 <!-- pricebook.xml — import prices -->173 <?xml version="1.0" encoding="UTF-8"?>174 <pricebooks xmlns="http://www.demandware.com/xml/impex/pricebook/2006-10-31">175 <pricebook>176 <header pricebook-id="usd-m-list-prices">177 <currency>USD</currency>178 <display-name xml:lang="x-default">USD List Prices</display-name>179 <online-flag>true</online-flag>180 </header>181 <price-tables>182 <price-table product-id="PROD-001">183 <amount quantity="1">149.99</amount>184 </price-table>185 <price-table product-id="SHIRT-BLUE-S">186 <amount quantity="1">39.99</amount>187 </price-table>188 </price-tables>189 </pricebook>190 </pricebooks>191 ```1921934. **Configure site preferences for custom cartridge settings**194195 Site preferences are custom attributes defined in Business Manager → Administration → Site Development → System Object Types → SitePreferences:196197 ```xml198 <!-- system-objecttype-extensions.xml — define custom site preference -->199 <?xml version="1.0" encoding="UTF-8"?>200 <metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">201 <type-extension type-id="SitePreferences">202 <custom-attribute-definitions>203 <attribute-definition attribute-id="myIntegration_apiEndpoint">204 <display-name xml:lang="x-default">My Integration API Endpoint</display-name>205 <type>string</type>206 <mandatory-flag>false</mandatory-flag>207 <externally-managed-flag>false</externally-managed-flag>208 <min-length>0</min-length>209 <max-length>255</max-length>210 </attribute-definition>211 <attribute-definition attribute-id="myIntegration_enabledFlag">212 <display-name xml:lang="x-default">My Integration Enabled</display-name>213 <type>boolean</type>214 <mandatory-flag>false</mandatory-flag>215 </attribute-definition>216 </custom-attribute-definitions>217 <group-definitions>218 <attribute-group group-id="MyIntegration">219 <display-name xml:lang="x-default">My Integration Settings</display-name>220 <attribute attribute-id="myIntegration_apiEndpoint"/>221 <attribute attribute-id="myIntegration_enabledFlag"/>222 </attribute-group>223 </group-definitions>224 </type-extension>225 </metadata>226 ```227228 Access in cartridge ISML/controller:229230 ```javascript231 // In SFCC ISML controller (server-side JS)232 var Site = require('dw/system/Site');233 var currentSite = Site.getCurrent();234235 var apiEndpoint = currentSite.getCustomPreferenceValue('myIntegration_apiEndpoint');236 var isEnabled = currentSite.getCustomPreferenceValue('myIntegration_enabledFlag');237 ```2382395. **Configure and run import jobs**240241 SFCC import jobs are configured in Business Manager → Administration → Operations → Jobs. Jobs use XML feed files placed in `/IMPEX/src/` or uploaded via the Jobs API:242243 ```javascript244 // Upload an XML file to IMPEX via OCAPI WebDAV before triggering job245 const importFile = fs.readFileSync('./catalog.xml');246247 // Upload via WebDAV (SFCC exposes IMPEX as WebDAV)248 const webdavUrl = `${instanceUrl}/on/demandware.servlet/webdav/Sites/Impex/src/catalog-import.xml`;249250 await fetch(webdavUrl, {251 method: "PUT",252 headers: {253 Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString("base64")}`,254 "Content-Type": "application/xml",255 },256 body: importFile,257 });258259 // Trigger the import job via Jobs API260 const jobResponse = await fetch(261 `${instanceUrl}/s/-/dw/data/v23_2/jobs/sfcc-site-archive-import/executions`,262 {263 method: "POST",264 headers: {265 Authorization: `Bearer ${adminToken}`,266 "Content-Type": "application/json",267 },268 body: JSON.stringify({269 parameters: [270 { name: "ImportFile", value: "catalog-import.xml" },271 { name: "catalogID", value: "your-catalog" },272 ],273 }),274 }275 );276 ```277278## Examples279280### Export orders for ERP sync281282```xml283<!-- Order export configuration — Business Manager → Merchant Tools → Site Preferences → Export/Import -->284<!-- Or via OCAPI Data API order search: -->285```286287```javascript288// Paginated order export via OCAPI Data API289async function exportOrdersSince(sinceDate: string) {290 const token = await getAdminToken();291 const instanceUrl = process.env.SFCC_INSTANCE_URL!;292 const siteId = process.env.SFCC_SITE_ID!;293294 let start = 0;295 const count = 100;296 const allOrders = [];297298 while (true) {299 const response = await fetch(300 `${instanceUrl}/s/${siteId}/dw/data/v23_2/order_search`,301 {302 method: "POST",303 headers: {304 Authorization: `Bearer ${token}`,305 "Content-Type": "application/json",306 },307 body: JSON.stringify({308 query: {309 filtered_query: {310 query: { match_all_query: {} },311 filter: {312 range_filter: {313 field: "creation_date",314 from: sinceDate,315 },316 },317 },318 },319 select: "(**)",320 count,321 start,322 sorts: [{ field: "creation_date", sort_order: "asc" }],323 }),324 }325 );326327 const { hits, total } = await response.json();328 allOrders.push(...(hits ?? []));329 start += count;330 if (start >= total) break;331 }332333 return allOrders;334}335```336337### Create a promotion via OCAPI338339```javascript340async function createPromotion(promo: {341 id: string;342 name: string;343 discountPercent: number;344 startDate: string;345 endDate: string;346}) {347 const token = await getAdminToken();348 const instanceUrl = process.env.SFCC_INSTANCE_URL!;349 const siteId = process.env.SFCC_SITE_ID!;350351 await fetch(352 `${instanceUrl}/s/${siteId}/dw/data/v23_2/promotions/${promo.id}`,353 {354 method: "PUT",355 headers: {356 Authorization: `Bearer ${token}`,357 "Content-Type": "application/json",358 },359 body: JSON.stringify({360 id: promo.id,361 name: { default: promo.name },362 enabled: true,363 start_date: promo.startDate,364 end_date: promo.endDate,365 discount: {366 type: "percentage",367 value: promo.discountPercent,368 },369 promotion_class: "order",370 }),371 }372 );373}374```375376## Best Practices377378- **Validate XML imports against Demandware schemas** before uploading — the XSD files are available in Business Manager under Administration → Site Development → System Object Types; invalid XML fails silently without line-level error messages379- **Use unique job IDs for concurrent imports** — SFCC jobs are single-threaded per job definition; use multiple job definitions if you need parallel catalog + inventory imports380- **Always include `catalog-id` in catalog XML** — mismatched or missing catalog IDs cause products to import into the wrong catalog or fail completely381- **Test imports on staging before production** — there is no bulk "undo" for catalog imports; test with a small subset first382- **Monitor job logs in BM → Administration → Operations → Jobs** — failed jobs log to `/IMPEX/log/`; download and review logs immediately after automated imports383- **Use `<display-name xml:lang="x-default">` for all localized strings** — the `x-default` locale is required; missing it causes display issues in all locales384- **Set site preferences via import XML, not manually** — document all custom site preference values in XML files committed to version control for environment consistency385386## Common Pitfalls387388| Problem | Solution |389|---------|----------|390| Products imported but not visible in storefront | Check product `online-flag` is `true`, the category assignment has `primary-flag` set, and the site catalog is assigned to the current site |391| Import job completes but log shows "0 records processed" | Verify the file was uploaded to the correct IMPEX path and the job's `ImportFile` parameter matches the exact filename including extension |392| Custom site preference not appearing in BM UI | Ensure the `system-objecttype-extensions.xml` has been imported via BM → Administration → Site Development → Import & Export and the cache has been cleared |393| Inventory not updating despite successful import | Check that the `inventory-list` `list-id` in the XML matches the inventory list assigned to the site in BM → Merchant Tools → Products and Catalogs |394| OCAPI Data API returns 403 on job trigger | The client ID must have Data API permissions for the `jobs` resource; verify in BM → Administration → Site Development → OCAPI Settings → Data |395| Prices show default catalog price instead of imported pricebook | Assign the pricebook to the site customer groups in BM → Merchant Tools → Pricing → Pricebooks; imported pricebooks are not active until assigned |396397## Related Skills398399- @sfcc-cartridge-development400- @sfcc-ocapi-scapi401- @catalog-management402- @product-import-export403- @promotion-engine