Intellij SFCC teaches the IDE the file formats SFCC uses. Import and export XML, form definitions and the JSON files of a cartridge are validated while you type, with completion for elements, attributes and keys and a red mark on anything the platform would reject. The XML schemas are bundled with the plugin, so validation works offline
hooks.json the name value offers the platform's 311 built-in hook pointsImport and export XML
The plugin registers 53 SFCC schemas. A file is validated when its root element declares the matching SFCC namespace, the same way Business Manager exports it
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="storefront-catalog">
<category category-id="mens">
<display-name xml:lang="x-default">Mens</display-name>
<online-flag>true</online-flag>
</category>
</catalog>With the namespace in place you get completion for every element and attribute and errors for missing, misplaced or misspelled items
| Area | Schemas |
|---|---|
| Catalog and search | catalog, pricebook, inventory, priceadjustmentlimits, productlist, search, search2, sort, store |
| Marketing | promotion, coupon, couponredemption, sourcecode, abtest, abtestparticipants, slot, giftcertificate, assignment |
| Customers | customer, customergroup, customerlist, customerlist2, customerpaymentinstrument, customeractivedata, customercdnsettings |
| Orders and checkout | order, returnimportfeed, shippingorderupdatefeed, paymentmethod, paymentprocessor, shipping, tax |
| Site and configuration | site, preferences, metadata, customobject, jobs, schedules, services, urlrules, redirecturl, cachesettings, csrfwhitelists, locales, geolocation, sitemapconfiguration, pagemetatag, oauth, feed |
| Content | library |
| Cartridge code | form, bmext, dcext |
Each schema is registered for one namespace version, for example catalog/2006-10-31 or jobs/2015-07-01
Form definitions
Form XML in a forms folder, with the namespace http://www.demandware.com/xml/form/2008-04-19, is validated against form.xsd. On top of the schema the plugin adds:
- Completion and navigation for resource keys in
label,description,range-error,value-error,missing-errorandparse-error, taken from yourformsresource bundles - Completion of form names in the
nameattribute of an<include>, and a gutter icon that opens the included form. With Global scope the icon lists the form in every cartridge, with a site selected it opens the one that comes first in that site's cartridge path - Highlighting of numbers in
min-lengthandmax-lengthand of keywords intype,mandatoryandvalid-form
How scripts and templates reach these forms, for example server.forms.getForm('billing'), is covered in SFCC Contracts
Cartridge JSON files
These files get a schema from the plugin, picked by file name. The schema name shows in the JSON schema widget of the status bar
| File | Schema | Also |
|---|---|---|
hooks.json | Salesforce B2C Hooks | name completes the platform's 311 hook points, labeled by group such as Request Hooks, Order Hooks, Calculate Hooks, Payment Hooks, Shop Hooks and SCAPI Hooks. script completes script paths and has a gutter icon to the script |
steptypes.json | Salesforce B2C Steptypes | module completes script paths and has a gutter icon to the job step script |
caches.json | Salesforce B2C Caches | Validates the custom cache definitions |
package.json | hooks and caches complete JSON file paths and have a gutter icon that opens the file |
{
"hooks": [
{
"name": "dw.order.calculate",
"script": "./scripts/hooks/cart/calculate.js"
}
]
}Click the gutter icon (Navigate to file) next to script to open the script. Calls such as HookMgr.callHook('app.payment.processor.basic_credit', ...) resolve to the same hooks.json entries, see SFCC Contracts
Page Designer JSON
Meta definition files of Page Designer get their own schema by folder
| Folder | Schema |
|---|---|
experience/pages | Salesforce B2C Page Designer - Pages |
experience/components | Salesforce B2C Page Designer - Components |
experience/aspects | Salesforce B2C Page Designer - Aspects |
experience/editors | Salesforce B2C Page Designer - Editors |
Unlike the XML schemas, these four are downloaded by the IDE the first time you open such a file. References between Page Designer files, such as a custom editor's type or its scripts, navigate with Cmd+Click (Ctrl+Click), and the resource paths of custom editors complete the cartridge's static CSS and JavaScript files
Troubleshooting
| Symptom | What to do |
|---|---|
| An XML file isn't validated | Check that the root element declares an SFCC namespace from the table, spelled exactly as Business Manager exports it |
| "URI is not registered" on the namespace | The file uses a namespace version the plugin doesn't register. Use the version from a current Business Manager export |
| A Page Designer file has no schema | The IDE couldn't download it. Check your network and that remote JSON schemas are allowed in Settings › Languages & Frameworks › Schemas and DTDs › Remote JSON Schemas |
hooks.json has no hook name completion | The file must be named exactly hooks.json, and its cartridge must be linked |
| The wrong schema is applied to a JSON file | Pick the schema in the JSON schema widget of the status bar, or check the file name |