Customer Data

You can use the Salesforce B2C Commerce API to run customer searches.

For example, when using the Customer Service Suite. B2C Commerce supports a search relevance service.

You can also access customer data programmatically. See the B2C Commerce API documentation.

Your application can interact with OAuth2 Providers, which enable you to authenticate and obtain information about customers at their request via their accounts with other parties.

You can use the search relevance functionality to improved performance.

Many customers use the Salesforce B2C Commerce scripting API to run customer searches. B2C Commerce automatically performs a full-text search.

To take advantage of the search relevance functionality and its improved performance, convert all code to use the searchProfiles and processProfiles methods.

The dw.customer.CustomerMgr APIs behave as follows:

  • Wildcards are filtered from the query (*, %, +) and replaced by spaces.

  • LIKE and ILIKE queries are executed as full text queries (working on whole words).

  • LIKE queries are case insensitive.

  • Using logical operators can change the execution of LIKE/ILIKE clauses to exact string comparisons, depending on how they are combined.

    LIKE and ILIKE work on the entire text, but with some text preprocessing, such as stemming. This type of analysis, however, can't be used on some queries, depending on the combination of logical operators.

  • Using logical operators can result in degraded performance, depending on how they are combined.

    Having both AND and OR in the same query impacts performance.

  • Having range queries (which includes anything such as a>b) impacts performance.

  • The search only returns the first 1000 hits from the search result.

The scripting API, dw.customer.CustomerMgr.processProfiles() enables you to process customer profiles in batch mode. This API, based on the full text search service, can process a many profile objects with optimized search performance and memory management.

Use this API in custom jobs to replace these older APIs:

  • dw.customer.CustomerMgr.queryProfiles(…)
  • dw.object.SystemObjectMgr.querySystemObject(profile, …)

The dw.customer.CustomerMgr.processProfiles(…) API accepts a customer profile object query and a JavaScript callback function as input parameters. The method searches customer profiles based on the specified query parameters and executes the specified callback function for each search result.

Here is an example of how you would use this API:

OAuth2 authenticates customers and obtains information about them by interacting with other parties such as Google, Facebook, or LinkedIn. Customers must authorize such access.

Salesforce B2C Commerce supports the OAuth2 Specification for storefronts to interact with OAuth2 Providers.

This feature also makes it faster and easier for customers to register with and log in to your storefront. Instead of entering personal information, customers can log in with an existing account, such as a Google account. Using an existing account gives your storefront permission to retrieve their personal information from that account.

This feature involves the following steps.

StepWho does it?
Register Your Site ("Application") with the OAuth2 Providers that you want to support.Storefront developers
Configure the OAuth2 Providers for your storefront.Storefront developers and admins
Use OAuth2 APIs in your storefront to give customers the option to log in using external accounts.Storefront developers

For more information, see Configure OAuth2 Providers.

To enable your storefront to interact with OAuth2 providers such as Google and Facebook, register your site as a client application with the providers you want to support.

The registration process is provider-specific. The following sections provide some helpful information about the registration processes of popular OAuth2 providers to help you get started.

This topic assumes that you are familiar with the OAuth2 specification and OAuth2-related concepts. In addition, several of the links provided here require a site-specific account.

Obtain client credentials for your application from the Google API Console.

For information on using OAuth2 with Google, see the following resources:

To register your client application, go to https://www.linkedin.com/secure/developer.

For more information, see https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication.

To register your client application, go to https://account.live.com/developers/applications/index.

If you have a regular Live customer account through which you can test OAuth login as an end user, you can see what permissions you have given the client application by going Here and selecting Apps and Services.

For background information, see https://docs.microsoft.com/en-us/azure/active-directory/develop/.

To register your client application, go to https://developers.facebook.com/apps.

Facebook doesn't follow the OAuth2 specification in some older versions, because some of the responses in the authentication flow are in plain text, instead of JSON. Facebook also expects a non-standard access token query parameter name in one of the URLs.

For more information, see https://developers.facebook.com/docs/facebook-login/.

To register your client application, go to https://github.com/settings/applications/new. The Callback URL must be an absolute URL, for example:

https://domain/on/demandware.store/Sites-SiteGenesis-Site/default/Login-OAuthReentryGitHub

GitHub allows only one URL. For more information, see https://developer.github.com/apps/building-oauth-apps/.