Salesforce B2C Commerce 23.5 > Developing Your Site > Development Components > Scripts > Script Programming > Understanding Server-Side JavaScript

Scripting: Maintaining State

A script can't maintain state from one execution to the next. After the execution of a script, all variables are erased from the system.

To maintain state across calls, use other mechanisms such as:

Using the Session

Use the Session class to access details about browser actions, such as:

Using Persistent Business Objects

The SiteGenesis application handles most general ecommerce processing situations. However, as you develop your storefront, you might identify a particular processing need that isn't implemented. In that case, you might want to create a custom business object to handle the transaction. For example, you might want to offer customers the ability to add a monogram or personalized name to certain products such as tote bags or camera cases.

Using Client-Side Cookies

Using the Salesforce B2C Commerce APIs, not only can you collect information about the cookies that are bound to a session, you can also track all associated cookies via an array.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.