You are here: Configuration > Rules > Use Case - Fire Configuration Rules Once per Session

Use Case - Fire Configuration Rules Once per Session

OVERVIEW

What Does It Do? 

Some rules require gathering data from external sources and consequently, can be time consuming. When the data doesn’t change rapidly, triggering the web service for every Configuration Update isn't necessary. In this article, we'll show you how to manage configuration rules so they will fire once, and only once, during a configuration sessions (both Add and Reconfigure mode).

ClosedHow Does It Work?

ClosedFor the Add Scenario 

ClosedFor Reconfigure Scenario


ADMINISTRATION

ClosedStep 1: Create New Configuration Attributes

  1. Navigate from Admin Home Page > Products > Catalog Definition > All Product Families > Configurable Attribute > List.
  2. Click Add.
  3. Name the attribute: Run Once Begin (runOnceBegin).
  4. Select the Boolean radio button.
  5. Click Add.
  6. Select True for the Default option under Default Data.
  7. Select the check-box for the Hidden option.

  8. Click Update and New.
  9. Repeat Steps 3-7. Name the attribute: Run Once End (runOnceEnd).
  10. Click Update.

ClosedStep 2: Create New Commerce Attribute

  1. Navigate from Admin Home Page > Commerce and Documents > Process Definition > Commerce Process > Documents > List > Line (Sub-Document)> Attributes > List.
  2. Click Add.
  3. Name the attribute: Cfg Run Once (cfgRunOnce_line).
  4. Choose Boolean as the Attribute Type.
  5. Click Add.
  6. Click the Default Tab.
  7. Select the Data radio button.
  8. Select the True radio button.
  9. Click the Document Views tab.
  10. Click Select All under Hide for all options.
  11. Click Update.

ClosedStep 3: Line Item Default

  1. Navigate to your Commerce Process > Documents > List > Line.
  2. Click the Line sub-document link.
  3. Verify or Select Define Advanced Default.
  4. Copy the runOnceEnd to cfgRunOnce_line for new or reconfigured items.

    ClosedClick to see a sample script.

  5. Click Update.

ClosedStep 4: Configuration Layout Editor

  1. Navigate from Admin Home Page > Products > Catalog Definition > Product Families > List > Product Family > Configuration Flows.
  2. Click the Layout link next to a configuration flow.
  3. Add attributes to the Layout Editor.
  4. Click Save.

ClosedStep 5: Configuration Rules

  1. Navigate from Admin Home Page > Products > Catalog Definition > Product Families > List > Product Family > Recommendations.
  2. Click Add.
  3. Create two rules: SetRunOnceBegin(setRunOnceBegin) and SetRunOnceEnd (setRunOnceEnd).
  4. Click Add.
  5. Navigate to each configuration rule that you want to run only ONCE per session.
  6. Add the condition runOnceBegin == runOnceEnd to each.
  7. Re-order attributes and rules to ensure that all attributes for which you want to run only ONCE per session are present between runOnceBegin and runOnceEnd.
    1. This is important because configuration rules run based on the order of the attributes.

NOTES

RELATED TOPICS

Related Topics Link IconSee Also