Store and query custom business data using CustomObjectMgr, OCAPI Data API, and Shopper Custom Objects API. Use this skill whenever the user needs to create, read, update, or search custom object instances, build processing queues with status fields, choose between site-scoped and organization-scoped storage, or query custom objects with bool/term filters. Also use when persisting non-standard data -- even if they just say 'store config per site' or 'query my custom data'.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Store and query custom business data using CustomObjectMgr, OCAPI Data API, and Shopper Custom Objects API. Use this skill whenever the user needs to create, read, update, or search custom object instances, build processing queues with status fields, choose between site-scoped and organization-scoped storage, or query custom objects with bool/term filters. Also use when persisting non-standard data -- even if they just say 'store config per site' or 'query my custom data'.
B2C Custom Objects
Custom objects store business data that doesn't fit into standard system objects. They support both site-scoped and organization-scoped (global) data, with full CRUD operations via Script API and OCAPI.
When to Use Custom Objects
Use Case
Example
Business configuration
Store configuration per site or globally
Integration data
Cache external system responses
Custom entities
Loyalty tiers, custom promotions, vendor data
Temporary processing
Job processing queues, import staging
Custom Object Types
Custom objects are defined in Business Manager under Administration > Site Development > Custom Object Types. Each type has:
ID: Unique identifier (e.g., CustomConfig)
Key Attribute: Primary key field for lookups
Attributes: Custom attributes for data storage
Scope: Site-scoped or organization-scoped (global)
varCustomObjectMgr = require('dw/object/CustomObjectMgr');
// Query with attribute filtervar objects = CustomObjectMgr.queryCustomObjects(
'CustomConfig', // Type'custom.isActive = {0}', // Query (uses positional params)'creationDate desc', // Sort ordertrue// Parameter value for {0}
);
while (objects.hasNext()) {
var obj = objects.next();
// Process object
}
objects.close();
Deleting Custom Objects
varCustomObjectMgr = require('dw/object/CustomObjectMgr');
varTransaction = require('dw/system/Transaction');
Transaction.wrap(function() {
var obj = CustomObjectMgr.getCustomObject('CustomConfig', 'keyToDelete');
if (obj) {
CustomObjectMgr.remove(obj);
}
});
Getting All Objects of a Type
varCustomObjectMgr = require('dw/object/CustomObjectMgr');
// Get all objects of a typevar allConfigs = CustomObjectMgr.getAllCustomObjects('CustomConfig');
while (allConfigs.hasNext()) {
var config = allConfigs.next();
// Process
}
allConfigs.close();
GET /s/-/dw/data/v25_6/custom_objects/{object_type}/{key}
Authorization: Bearer {token}
Note: Use /s/{site_id}/dw/data/v25_6/custom_objects/... for site-scoped objects, or /s/-/dw/data/v25_6/custom_objects/... for organization-scoped (global) objects.
For read-only access from storefronts, use the Shopper Custom Objects API. This requires specific OAuth scopes.
Get Custom Object (Shopper)
GET https://{shortCode}.api.commercecloud.salesforce.com/custom-object/shopper-custom-objects/v1/organizations/{organizationId}/custom-objects/{objectType}/{key}?siteId={siteId}
Authorization: Bearer {shopper_token}
Required Scopes
For the Shopper Custom Objects API, configure these scopes in your SLAS client:
sfcc.shopper-custom-objects - Global read access to all custom object types