Salesforce B2C Commerce 23.6 > B2C Commerce API > B2C Commerce Script > dw.web
dw.web
Class URLAction
Object
dw.web.URLAction
The class is needed for the URL creation within template processing. It represents a reference to a pipeline name and start node, usually used in a HREF or a FORM action. URLAction instances are usually passed to one of the methods in URLUtils in order to generate an appropriately constructed Commerce Cloud Digital URL. For example:

var urlAction : URLAction = new URLAction("SimplePipeline-Start", "SampleSite");
var url : URL = URLUtils.abs(false, urlAction1);
// url.toString() equals "http://" + request.httpHost + "/on/demandware.store/Sites-SampleSite-Site/default/SimplePipeline-Start"

Constructor Summary
URLAction(action : String)
Constructs an action for the current site and locale.
URLAction(action : String, siteName : String)
Constructs an action for the specified site and the current locale.
URLAction(action : String, siteName : String, locale : String)
Constructs an action for the specified site and locale.
URLAction(action : String, siteName : String, locale : String, hostName : String)
Constructs an URL action for the specified site, locale and hostname.
Method Summary
Methods inherited from class Object
Constructor Detail
URLAction
public URLAction(action : String)
Constructs an action for the current site and locale.
Parameters:
action - the target pipeline/controller, e.g. 'Default-Start'

URLAction
public URLAction(action : String, siteName : String)
Constructs an action for the specified site and the current locale.
Parameters:
action - the target pipeline/controller, e.g. 'Default-Start'
siteName - the target site, e.g. 'SampleSite'

URLAction
public URLAction(action : String, siteName : String, locale : String)
Constructs an action for the specified site and locale.
Parameters:
action - the target pipeline/controller, e.g.: 'Default-Start'
siteName - the target site, e.g. 'SampleSite'
locale - the target locale, e.g. 'default'

URLAction
public URLAction(action : String, siteName : String, locale : String, hostName : String)
Constructs an URL action for the specified site, locale and hostname.

The hostname must be defined in the site alias settings. If no hostname is provided, the HTTP/HTTPS host defined in the site alias settings will be used. If no HTTP/HTTPS host is defined in the site alias settings, the hostname of the current request is used.

Parameters:
action - the target pipeline/controller, e.g.: 'Default-Start'
siteName - the target site, e.g. 'SampleSite'
locale - the target locale, e.g. 'default'
hostName - the host name, e.g. ‘www.shop.com'
Throws:
Exception - if hostName is not defined in site alias settings

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.