System's data with SFCC Digital Script API

Introduction

All requires we have seen in previous chapters of SFRA course that starts with dw/ means that are part of the Salesforce Commerce Cloud API. we don't have access to the source code. In case you need details, functions, attributes about any of them, refer to the official documentation.

The use will them to access data about the system, such as: products, catalogs, prices, etc. You can access the API from both controllers and ISML templates for expressions or inside <isscript> tags.

image

DW Requires example

API Packages

The Digital Script API is organized in packages, just like Java. Unlike Java, inheritance is not possible from these classes or packages when you create a script. You can only use the properties and methods of these classes in your scripts.

In this API, the TopLevel package is the default package. It is similar to java.lang in Java. It does not need to be imported into scripts. It provides standard ECMAScript classes and extensions, such as: Error, Date, Function, String, Math, Number, XML.

The TopLevel.global class contains many of the common constants and properties used in scripts. Some properties are: customer, request and session.

In these packages there are many classes that end with Mgr: These classes, for example, dw.catalog.ProductMgr, retrieves instances of business objects related to the package they belong to.

For example, use ProductMgr.getProduct(String id) to get a product using a unique identifier. The method returns a Product instance which you can use to find information about the product. This pattern is repeated for all Managers.

The table below shows the description of some of these packages. You don’t need to remember everything, just use it as a reference for future needs:

eCommerce API Packages

Description

dw.campaign

For campaign and promotions.
Classes: PromotionMgr, Campaign, Promotion, SourceCodeGroup, etc.

dw.catalog

For catalog, product, and price book.
Classes: CatalogMgr, Category, Product, Recommendation, PriceBook, etc.

dw.content

For non-product content management.
Classes: ContentMgr, Content, Folder, Library, etc.

dw.customer

For customer profile and account.
Classes: CustomerMgr, Customer, Profile, ProductList, OrderHistory, etc.

dw.order

For orders, including: basket, coupons, line items, payment, shipment
Classes: Basket, Order, ProductLineItem, ShippingMgr, TaxMgr, etc.

Generic API Packages

Description

dw.crypto

Encryption services using JCA; DES, Triple-DES, AES, RSA, etc.
Classes: Cipher, MessageDigest

dw.io

Input and output.
Classes: File, FileReader, CSVStreamReader, XMLStreamReader, etc.

dw.object

System base classes and custom objects.
Classes: PersistentObject, ExtensibleObject, CustomObjectMgr, etc.

dw.rpc

Web services related APIs.
Classes: WebReference, Stub

dw.system

System functions.
Classes: Site, Request, Session, Logger

dw.util

Similar to the java.util API: collections, maps and calendar classes.

dw.value

Immutable value objects.
Classes: Money, Quantity

dw.web

Web-processing.
Classes: URLUtils, Forms, Cookie, HttpParameterMap, etc.

You can also embed SFCC Script API calls into ISML by using the <isset> tag as you can see below:

				
<isset name="PaymentInst" value="${require('dw/order/PaymentInstrument');}" scope="page" />
				
			

Inside of the <isscript> tag, you can fully qualify every class you want to use or you can import any packages at the top of the script:

<isscript>
    const CatalogMgr = require('dw/catalog/CatalogMgr');
    const siteCatalog = CatalogMgr.getSiteCatalog();
    ...
</isscript>
				
			

Be aware, this practice of adding logic inside ISML templates is NOT RECOMMENDED, so use it with moderation. Instead, always try to add any logic in the Controller.

📝 Exercise: Using customer API

Create a Controller that requires needed customer Digital Script API and send to a new template.isml if current customer is authenticated or not.

image

Digital Script API. Customer package

JONATAN JUMBERT

Guiding your journey in Salesforce Commerce Cloud.
Commerce GPT
Contact us
SFCC Study Guide
SFCC FAQ

Find Me Everywhere

linkedin
Copyright © 2026 all rights reserved.