dw.customer.CustomerMgrSearches for a single profile instance.
Searches for profile instances.
Searches for a single profile instance.
Searches for profile instances.
The method throws an exception if any of the following conditions are encountered:
A valid login name is between 1 and 256 characters in length (not counting leading or trailing whitespace), and may contain only the following characters:
Note: a storefront can be customized to provide further constraints on characters in a login name, but it cannot remove any constraints described above.
If customers are created using this Script API call then any updated to the customer records should be done through Script API calls as well. The customer records created with Script API call should not be updated with OCAPI calls as the email validation is handled differently in these calls and may result in InvalidEmailException.
The method throws an exception if any of the following conditions are encountered:
A valid login name is between 1 and 256 characters in length (not counting leading or trailing whitespace), and may contain only the following characters:
Note: a storefront can be customized to provide further constraints on characters in a login name, but it cannot remove any constraints described above.
A valid CustomerNo is between 1 and 100 characters in length (not counting leading or trailing whitespace). Commerce Cloud Digital recommends that a CustomerNo only contain characters valid for URLs.
If customers are created using this Script API call then any updated to the customer records should be done through Script API calls as well. The customer records created with Script API call should not be updated with OCAPI calls as the email validation is handled differently in these calls and may result in InvalidEmailException.
null is returnedNull if the token is invalid.
Note: Typically the ID of an automatically created customer list is equal to the ID of the site.
The search can be configured using a simple query language, which provides most common filter and operator functionality. For a description of this query language, see the queryProfile(String, Object...) method. The callback function will be supplied with a single argument of type 'Profile'. When the callback function defines additional arguments, they will be undefined when the function is called. When the callback function doesn't define any arguments at all, it will be called anyway (no error will happen, but the function won't get a profile as parameter). Error during execution of the callback function will be logged, and execution will continue with the next element from the result set. This method can be used as in this example (which counts the number of men):
var count=0;
function callback(profile: Profile)
{
count++;
dw.system.Logger.debug("customer found: "+profile.customerNo)
}
CustomerMgr.processProfiles(callback, "gender=1");
dw.system.Logger.debug("found "+count+" men in customer list");
Searches for a single profile instance.
The search can be configured using a simple query language, which provides most common filter and operator functionality.
The identifier for an attribute to use in a query condition is always the
ID of the attribute as defined in the type definition. For custom defined attributes
the prefix custom is required in the search term (e.g. custom.color = {1}),
while for system attributes no prefix is used (e.g. name = {4}).
Supported attribute value types with sample expression values:
'String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00true, false'search@demandware.com', '*@demandware.com''String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5'String', 'Str*', 'Strin?'1, 3E4The following operators are supported in a condition:
= Equals - All types; supports NULL value (thumbnail = NULL)!= Not equals - All types; supports NULL value (thumbnail != NULL)< Less than - Integer, Number and Date types only> Greater than - Integer, Number and Date types only<= Less or equals than - Integer, Number and Date types only>= Greater or equals than - Integer, Number and Date types onlyLIKE Like - String types and Email only; use if leading or trailing
wildcards will be used to support substring search(custom.country LIKE 'US*')ILIKE Caseindependent Like - String types and Email only, use to support
case insensitive query (custom.country ILIKE 'usa'), does also support wildcards for
substring matchingConditions can be combined using logical expressions 'AND', 'OR' and 'NOT'
and nested using parenthesis e.g.
gender = {1} AND (age >= {2} OR (NOT profession LIKE {3})).
The query language provides a placeholder syntax to pass objects as
additional search parameters. Each passed object is related to a
placeholder in the query string. The placeholder must be an Integer that
is surrounded by braces. The first Integer value must be '0', the second
'1' and so on, e.g.
querySystemObjects("sample", "age = {0} or creationDate >= {1}", 18, date)
If there is more than one object matching the specified query criteria, the
result is not deterministic. In order to retrieve a single object from a sorted result
set it is recommended to use the following code:
queryProfiles("", "custom.myAttr asc", null).first().
The method first() returns only the next element and closes the
iterator.
This method will be deprecated in a future release. We recommend to use methods searchProfile(String, Object...),
searchProfiles(Map, String) and searchProfiles(String, String, Object...)
to search for customers, and to use method processProfiles(Function, String, Object...) to search and process customers in jobs.
queryString.
The search can be configured using a simple query language, which provides most common filter and operator functionality. For a description of this query language, see the queryProfile(String, Object...) method. This method will be deprecated in a future release. We recommend to use methods searchProfile(String, Object...), searchProfiles(Map, String) and searchProfiles(String, String, Object...) to search for customers, and to use method processProfiles(Function, String, Object...) to search and process customers in jobs.
Searches for profile instances.
The search can be configured with a map, which key-value pairs are converted into a query expression. The key-value pairs are turned into a sequence of '=' or 'like' conditions, which are combined with AND statements.
Example:
A map with the key/value pairs: 'name'/'tom*', 'age'/66
will be converted as follows: "name like 'tom*' and age = 66"
The identifier for an attribute to use in a query condition is always the
ID of the attribute as defined in the type definition. For custom defined attributes
the prefix custom is required in the search term (e.g. custom.color = {1}),
while for system attributes no prefix is used (e.g. name = {4}).
Supported attribute value types with sample expression values:
'String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00true, false'search@demandware.com', '*@demandware.com''String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5'String', 'Str*', 'Strin?'1, 3E4The sorting parameter is optional and may contain a comma separated list of
attribute names to sort by. Each sort attribute name may be followed by an
optional sort direction specifier ('asc' | 'desc'). Default sorting directions is
ascending, if no direction was specified.
Example: age desc, name
Please note that specifying a localized custom attribute as the sorting attribute is
currently not supported.
It is strongly recommended to call close() on the returned SeekableIterator
if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.
See SeekableIterator.close()
Searches for a single profile instance.
The search can be configured using a simple query language, which provides most common filter and operator functionality.
The identifier for an attribute to use in a query condition is always the
ID of the attribute as defined in the type definition. For custom defined attributes
the prefix custom is required in the search term (e.g. custom.color = {1}),
while for system attributes no prefix is used (e.g. name = {4}).
Supported attribute value types with sample expression values:
'String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00true, false'search@demandware.com', '*@demandware.com''String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5'String', 'Str*', 'Strin?'1, 3E4The following operators are supported in a condition:
= Equals - All types; supports NULL value (thumbnail = NULL)!= Not equals - All types; supports NULL value (thumbnail != NULL)< Less than - Integer, Number and Date types only> Greater than - Integer, Number and Date types only<= Less or equals than - Integer, Number and Date types only>= Greater or equals than - Integer, Number and Date types onlyLIKE Like - String types and Email only; use if leading or trailing
wildcards will be used to support substring search(custom.country LIKE 'US*')ILIKE Caseindependent Like - String types and Email only, use to support
case insensitive query (custom.country ILIKE 'usa'), does also support wildcards for
substring matchingConditions can be combined using logical expressions 'AND', 'OR' and 'NOT'
and nested using parenthesis e.g.
gender = {1} AND (age >= {2} OR (NOT profession LIKE {3})).
The query language provides a placeholder syntax to pass objects as
additional search parameters. Each passed object is related to a
placeholder in the query string. The placeholder must be an Integer that
is surrounded by braces. The first Integer value must be '0', the second
'1' and so on, e.g.
querySystemObjects("sample", "age = {0} or creationDate >= {1}", 18, date)
If there is more than one object matching the specified query criteria, the
result is not deterministic. In order to retrieve a single object from a sorted result
set it is recommended to use the following code:
queryProfiles("", "custom.myAttr asc", null).first().
The method first() returns only the next element and closes the
iterator.
If the customer search API is configured to use the new Search Service, the following differences apply:
queryString.
The search can be configured using a simple query language, which provides most common filter and operator functionality. For a description of this query language, see the searchProfile(String, Object...) method.
If the customer search API is configured to use the new Search Service, the following differences apply:
Searches for profile instances.
The search can be configured with a map, which key-value pairs are converted into a query expression. The key-value pairs are turned into a sequence of '=' or 'like' conditions, which are combined with AND statements.
Example:
A map with the key/value pairs: 'name'/'tom*', 'age'/66
will be converted as follows: "name like 'tom*' and age = 66"
The identifier for an attribute to use in a query condition is always the
ID of the attribute as defined in the type definition. For custom defined attributes
the prefix custom is required in the search term (e.g. custom.color = {1}),
while for system attributes no prefix is used (e.g. name = {4}).
Supported attribute value types with sample expression values:
'String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5yyyy-MM-dd e.g. 2007-05-31 (Default TimeZone = UTC)yyyy-MM-dd'T'hh:mm:ss+Z e.g. 2007-05-31T00:00+Z (Z TimeZone = UTC) or 2007-05-31T00:00:00true, false'search@demandware.com', '*@demandware.com''String', 'Str*', 'Strin?'1, 3E41.0, 3.99E5'String', 'Str*', 'Strin?'1, 3E4The sorting parameter is optional and may contain a comma separated list of
attribute names to sort by. Each sort attribute name may be followed by an
optional sort direction specifier ('asc' | 'desc'). Default sorting directions is
ascending, if no direction was specified.
Example: age desc, name
Please note that specifying a localized custom attribute as the sorting attribute is
currently not supported.
It is strongly recommended to call close() on the returned SeekableIterator
if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.
If the customer search API is configured to use the new Search Service, the following differences apply: