Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Introduction to Sitecore CDP
Data availability
Managing your account
Managing system settings
Managing guests
Batch segmentation
Data browser
Audience export
Dashboards
Developer center
AI in CDP
Glossary
  • Sitecore CDP
  • Developer center
  • Conditions
  • Test a condition

Test a condition

Sitecore CDP enables you to test a condition by running it against a selected guest.

We recommend testing the condition before you publish it, to identify any errors and ensure optimal performance. After changing the code, re-test the condition with the same guest to check the results.

For more advanced use cases that require passing in headers and parameters in the request, you can test an advanced condition.

When you test a condition, Sitecore CDP tests the JavaScript on the server-side. This ensures that the JavaScript is validated within the context it will be executed in.

Note

Team members with a User, Developer, or Admin role in Sitecore Cloud Portal can test a condition.

To test a condition:

  1. Open the condition and click Test.

    Testing a condition
  2. In the Test Condition dialog, you can test against the default guest's attributes, or click in the search box and choose Recent to select from a list of recently active guests or Bookmarks to select from a list of bookmarked guests. To select a specific guest, enter their unique identifier into the search box. You can search for a guest using, for example, an email address, other unique identifier, or browser ID.

    Note

    If there is a guest whose data you often use when configuring or testing code, just click the star icon to bookmark the guest so you no longer have to search for them.

  3. To temporarily modify the guest data (this is only temporary and does not change any attributes associated with the guest), edit the JSON in the code editor.

  4. To configure the guest parameters and view them in the response of the test, you must include this JavaScript in the code editor to call the guest context:

    RequestResponse
    (function () {
            return { guest: guest };
    })();
  5. Click the Condition parameters option to enter values and click Test. The guest parameters is included in the response.

  6. To include the Point of Sale parameter and view it in the response of the test, you must include this JavaScript in the code editor to call the request context.

    RequestResponse
    (function () {
            return { request: request };
    })();
  7. Click the Experience request option and select the point of sale and click Test. The pointOfSale parameter is included in the response.

  8. To include the tenant parameters and view them in the response of the test, you must include this JavaScript in the code editor to call the tenant context, as shown here:

    RequestResponse
    (function () {
            return { tenant: tenant };
    })();
  9. Click the Condition parameters option to enter values and click Test. The tenant parameters are included in the response.

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2026 Sitecore